summaryrefslogtreecommitdiff
path: root/source3/libsmb/libsmb_stat.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-11-21 22:52:12 +0100
committerVolker Lendecke <vl@samba.org>2009-11-21 23:19:50 +0100
commite28545e85472c630244205f5c3fae4956089daa3 (patch)
treeade2f4e5461f0b0cb287add899d001ee3403d487 /source3/libsmb/libsmb_stat.c
parent384f303c2cafa6659c24a62209de846cd5d45d84 (diff)
downloadsamba-e28545e85472c630244205f5c3fae4956089daa3.tar.gz
samba-e28545e85472c630244205f5c3fae4956089daa3.tar.bz2
samba-e28545e85472c630244205f5c3fae4956089daa3.zip
s3: Fix some nonempty blank lines
Diffstat (limited to 'source3/libsmb/libsmb_stat.c')
-rw-r--r--source3/libsmb/libsmb_stat.c79
1 files changed, 33 insertions, 46 deletions
diff --git a/source3/libsmb/libsmb_stat.c b/source3/libsmb/libsmb_stat.c
index 95c5c52d6e..f8614d3154 100644
--- a/source3/libsmb/libsmb_stat.c
+++ b/source3/libsmb/libsmb_stat.c
@@ -7,17 +7,17 @@
Copyright (C) Tom Jansen (Ninja ISD) 2002
Copyright (C) Derrell Lipman 2003-2008
Copyright (C) Jeremy Allison 2007, 2008
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -36,15 +36,12 @@ generate_inode(SMBCCTX *context,
const char *name)
{
if (!context || !context->internal->initialized) {
-
errno = EINVAL;
return -1;
-
}
-
+
if (!*name) return 2; /* FIXME, why 2 ??? */
return (ino_t)str_checksum(name);
-
}
/*
@@ -60,20 +57,20 @@ setup_stat(SMBCCTX *context,
int mode)
{
TALLOC_CTX *frame = talloc_stackframe();
-
+
st->st_mode = 0;
-
+
if (IS_DOS_DIR(mode)) {
st->st_mode = SMBC_DIR_MODE;
} else {
st->st_mode = SMBC_FILE_MODE;
}
-
+
if (IS_DOS_ARCHIVE(mode)) st->st_mode |= S_IXUSR;
if (IS_DOS_SYSTEM(mode)) st->st_mode |= S_IXGRP;
if (IS_DOS_HIDDEN(mode)) st->st_mode |= S_IXOTH;
if (!IS_DOS_READONLY(mode)) st->st_mode |= S_IWUSR;
-
+
st->st_size = size;
#ifdef HAVE_STAT_ST_BLKSIZE
st->st_blksize = 512;
@@ -86,20 +83,19 @@ setup_stat(SMBCCTX *context,
#endif
st->st_uid = getuid();
st->st_gid = getgid();
-
+
if (IS_DOS_DIR(mode)) {
st->st_nlink = 2;
} else {
st->st_nlink = 1;
}
-
+
if (st->st_ino == 0) {
st->st_ino = generate_inode(context, fname);
}
-
+
TALLOC_FREE(frame);
return True; /* FIXME: Is this needed ? */
-
}
/*
@@ -125,22 +121,21 @@ SMBC_stat_ctx(SMBCCTX *context,
uint16 mode = 0;
SMB_INO_T ino = 0;
TALLOC_CTX *frame = talloc_stackframe();
-
+
if (!context || !context->internal->initialized) {
-
errno = EINVAL; /* Best I can think of ... */
TALLOC_FREE(frame);
return -1;
}
-
+
if (!fname) {
errno = EINVAL;
TALLOC_FREE(frame);
return -1;
}
-
+
DEBUG(4, ("smbc_stat(%s)\n", fname));
-
+
if (SMBC_parse_path(frame,
context,
fname,
@@ -164,15 +159,14 @@ SMBC_stat_ctx(SMBCCTX *context,
return -1;
}
}
-
+
srv = SMBC_server(frame, context, True,
server, share, &workgroup, &user, &password);
-
if (!srv) {
TALLOC_FREE(frame);
return -1; /* errno set by SMBC_server */
}
-
+
if (!SMBC_getatr(context, srv, path, &mode, &size,
NULL,
&access_time_ts,
@@ -183,19 +177,18 @@ SMBC_stat_ctx(SMBCCTX *context,
TALLOC_FREE(frame);
return -1;
}
-
+
st->st_ino = ino;
-
+
setup_stat(context, st, (char *) fname, size, mode);
-
+
st->st_atime = convert_timespec_to_time_t(access_time_ts);
st->st_ctime = convert_timespec_to_time_t(change_time_ts);
st->st_mtime = convert_timespec_to_time_t(write_time_ts);
st->st_dev = srv->dev;
-
+
TALLOC_FREE(frame);
return 0;
-
}
/*
@@ -221,25 +214,24 @@ SMBC_fstat_ctx(SMBCCTX *context,
struct cli_state *targetcli = NULL;
SMB_INO_T ino = 0;
TALLOC_CTX *frame = talloc_stackframe();
-
+
if (!context || !context->internal->initialized) {
-
errno = EINVAL;
TALLOC_FREE(frame);
return -1;
}
-
+
if (!file || !SMBC_dlist_contains(context->internal->files, file)) {
errno = EBADF;
TALLOC_FREE(frame);
return -1;
}
-
+
if (!file->file) {
TALLOC_FREE(frame);
return smbc_getFunctionFstatdir(context)(context, file, st);
}
-
+
/*d_printf(">>>fstat: parsing %s\n", file->fname);*/
if (SMBC_parse_path(frame,
context,
@@ -255,7 +247,7 @@ SMBC_fstat_ctx(SMBCCTX *context,
TALLOC_FREE(frame);
return -1;
}
-
+
/*d_printf(">>>fstat: resolving %s\n", path);*/
if (!cli_resolve_path(frame, "", context->internal->auth_info,
file->srv->cli, path,
@@ -266,41 +258,37 @@ SMBC_fstat_ctx(SMBCCTX *context,
return -1;
}
/*d_printf(">>>fstat: resolved path as %s\n", targetpath);*/
-
+
if (!cli_qfileinfo(targetcli, file->cli_fd, &mode, &size,
NULL,
&access_time_ts,
&write_time_ts,
&change_time_ts,
&ino)) {
-
time_t change_time, access_time, write_time;
-
+
if (!NT_STATUS_IS_OK(cli_getattrE(targetcli, file->cli_fd, &mode, &size,
&change_time, &access_time, &write_time))) {
-
errno = EINVAL;
TALLOC_FREE(frame);
return -1;
}
-
change_time_ts = convert_time_t_to_timespec(change_time);
access_time_ts = convert_time_t_to_timespec(access_time);
write_time_ts = convert_time_t_to_timespec(write_time);
}
-
+
st->st_ino = ino;
-
+
setup_stat(context, st, file->fname, size, mode);
-
+
st->st_atime = convert_timespec_to_time_t(access_time_ts);
st->st_ctime = convert_timespec_to_time_t(change_time_ts);
st->st_mtime = convert_timespec_to_time_t(write_time_ts);
st->st_dev = file->srv->dev;
-
+
TALLOC_FREE(frame);
return 0;
-
}
@@ -368,7 +356,6 @@ SMBC_fstatvfs_ctx(SMBCCTX *context,
unsigned long flags = 0;
uint32 fs_attrs = 0;
struct cli_state *cli = file->srv->cli;
-
/* Initialize all fields (at least until we actually use them) */
memset(st, 0, sizeof(*st));
@@ -389,7 +376,7 @@ SMBC_fstatvfs_ctx(SMBCCTX *context,
uint64_t actual_allocation_units;
uint64_t sectors_per_allocation_unit;
uint64_t bytes_per_sector;
-
+
/* Nope. If size data is available... */
if (cli_get_fs_full_size_info(cli,
&total_allocation_units,