From 35537c1255e9508b77fd9d9def1ac96e423bee46 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 10 Feb 2005 06:36:30 +0000 Subject: r5302: fixed a compilation problem on solaris caused by the recent include changes (This used to be commit e7e015f79b10c353848a17f31c91a0593790a560) --- source4/client/client.c | 19 +++++++------------ source4/client/smbmount.c | 2 +- source4/lib/util.c | 31 ++++++++++++++----------------- source4/librpc/rpc/dcerpc_util.c | 2 +- source4/ntvfs/simple/svfs_util.c | 10 ---------- source4/ntvfs/simple/vfs_simple.c | 11 +++++++++++ source4/param/loadparm.c | 2 +- source4/rpc_server/dcerpc_sock.c | 2 +- source4/smbd/server.c | 2 +- source4/winbind/wb_server.c | 2 +- 10 files changed, 38 insertions(+), 45 deletions(-) (limited to 'source4') diff --git a/source4/client/client.c b/source4/client/client.c index 5413beb3ba..986f35b971 100644 --- a/source4/client/client.c +++ b/source4/client/client.c @@ -929,7 +929,7 @@ static void do_mget(struct clilist_file_info *finfo) strlower(discard_const_p(char, finfo->name)); } - if (!directory_exist(finfo->name,NULL) && + if (!directory_exist(finfo->name) && mkdir(finfo->name,0777) != 0) { d_printf("failed to create directory %s\n",finfo->name); pstrcpy(cur_dir,saved_curdir); @@ -1301,15 +1301,11 @@ static int cmd_put(const char **cmd_ptr) dos_clean_name(rname); - { - struct stat st; - /* allow '-' to represent stdin - jdblair, 24.jun.98 */ - if (!file_exist(lname,&st) && - (strcmp(lname,"-"))) { - d_printf("%s does not exist\n",lname); - return 1; - } + /* allow '-' to represent stdin + jdblair, 24.jun.98 */ + if (!file_exist(lname) && (strcmp(lname,"-"))) { + d_printf("%s does not exist\n",lname); + return 1; } return do_put(rname, lname, False); @@ -2479,7 +2475,6 @@ static int cmd_reput(const char **cmd_ptr) pstring remote_name; fstring buf; char *p = buf; - struct stat st; pstrcpy(remote_name, cur_dir); pstrcat(remote_name, "\\"); @@ -2490,7 +2485,7 @@ static int cmd_reput(const char **cmd_ptr) } pstrcpy(local_name, p); - if (!file_exist(local_name, &st)) { + if (!file_exist(local_name)) { d_printf("%s does not exist\n", local_name); return 1; } diff --git a/source4/client/smbmount.c b/source4/client/smbmount.c index e18fb311aa..7f73807ec6 100644 --- a/source4/client/smbmount.c +++ b/source4/client/smbmount.c @@ -496,7 +496,7 @@ static void init_mount(void) asprintf(&smbmnt_path, "%s/smbmnt", dyn_BINDIR); - if (file_exist(smbmnt_path, NULL)) { + if (file_exist(smbmnt_path)) { execv(smbmnt_path, args); fprintf(stderr, "smbfs/init_mount: execv of %s failed. Error was %s.", diff --git a/source4/lib/util.c b/source4/lib/util.c index af41a20aa5..d95924670f 100644 --- a/source4/lib/util.c +++ b/source4/lib/util.c @@ -44,16 +44,15 @@ const char *tmpdir(void) /******************************************************************* Check if a file exists - call vfs_file_exist for samba files. ********************************************************************/ -BOOL file_exist(const char *fname, struct stat *sbuf) +BOOL file_exist(const char *fname) { struct stat st; - if (!sbuf) - sbuf = &st; - - if (stat(fname,sbuf) != 0) - return(False); - return((S_ISREG(sbuf->st_mode)) || (S_ISFIFO(sbuf->st_mode))); + if (stat(fname, &st) != 0) { + return False; + } + + return ((S_ISREG(st.st_mode)) || (S_ISFIFO(st.st_mode))); } /******************************************************************* @@ -74,18 +73,16 @@ time_t file_modtime(const char *fname) Check if a directory exists. ********************************************************************/ -BOOL directory_exist(const char *dname,struct stat *st) +BOOL directory_exist(const char *dname) { - struct stat st2; + struct stat st; BOOL ret; - if (!st) - st = &st2; - - if (stat(dname,st) != 0) - return(False); + if (stat(dname,&st) != 0) { + return False; + } - ret = S_ISDIR(st->st_mode); + ret = S_ISDIR(st.st_mode); if(!ret) errno = ENOTDIR; return ret; @@ -687,7 +684,7 @@ char *lock_path(TALLOC_CTX* mem_ctx, const char *name) dname = talloc_strdup(mem_ctx, lp_lockdir()); trim_string(dname,"","/"); - if (!directory_exist(dname,NULL)) { + if (!directory_exist(dname)) { mkdir(dname,0755); } @@ -738,7 +735,7 @@ char *smbd_tmp_path(TALLOC_CTX *mem_ctx, const char *name) char *fname, *dname; dname = lock_path(mem_ctx, "smbd.tmp"); - if (!directory_exist(dname,NULL)) { + if (!directory_exist(dname)) { mkdir(dname,0755); } diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c index ac15a62e54..3697d2f181 100644 --- a/source4/librpc/rpc/dcerpc_util.c +++ b/source4/librpc/rpc/dcerpc_util.c @@ -1338,7 +1338,7 @@ void dcerpc_log_packet(const struct dcerpc_interface_table *ndr, if (name == NULL) { return; } - if (!file_exist(name, NULL)) { + if (!file_exist(name)) { if (file_save(name, pkt->data, pkt->length)) { DEBUG(10,("Logged rpc packet to %s\n", name)); } diff --git a/source4/ntvfs/simple/svfs_util.c b/source4/ntvfs/simple/svfs_util.c index 3f6e205e71..ac5cf69e9a 100644 --- a/source4/ntvfs/simple/svfs_util.c +++ b/source4/ntvfs/simple/svfs_util.c @@ -182,13 +182,3 @@ uint16_t svfs_unix_to_dos_attrib(mode_t mode) return ret; } -/* - build a file_id from a stat struct -*/ -uint64_t svfs_file_id(struct stat *st) -{ - uint64_t ret = st->st_ino; - ret <<= 32; - ret |= st->st_dev; - return ret; -} diff --git a/source4/ntvfs/simple/vfs_simple.c b/source4/ntvfs/simple/vfs_simple.c index 6f634efd53..cebf7a5c32 100644 --- a/source4/ntvfs/simple/vfs_simple.c +++ b/source4/ntvfs/simple/vfs_simple.c @@ -172,6 +172,17 @@ static NTSTATUS svfs_chkpath(struct ntvfs_module_context *ntvfs, return NT_STATUS_OK; } +/* + build a file_id from a stat struct +*/ +static uint64_t svfs_file_id(struct stat *st) +{ + uint64_t ret = st->st_ino; + ret <<= 32; + ret |= st->st_dev; + return ret; +} + /* approximately map a struct stat to a generic fileinfo struct */ diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c index 288bc3a38e..121821b542 100644 --- a/source4/param/loadparm.c +++ b/source4/param/loadparm.c @@ -2028,7 +2028,7 @@ static BOOL handle_include(const char *pszParmValue, char **ptr) string_set(ptr, fname); - if (file_exist(fname, NULL)) + if (file_exist(fname)) return (pm_process(fname, do_section, do_parameter)); DEBUG(2, ("Can't find include file %s\n", fname)); diff --git a/source4/rpc_server/dcerpc_sock.c b/source4/rpc_server/dcerpc_sock.c index fb1ed56f4d..48537375d5 100644 --- a/source4/rpc_server/dcerpc_sock.c +++ b/source4/rpc_server/dcerpc_sock.c @@ -269,7 +269,7 @@ NTSTATUS dcesrv_sock_init(struct dcesrv_context *dce_ctx, NTSTATUS status; /* Make sure the directory for NCALRPC exists */ - if (!directory_exist(lp_ncalrpc_dir(), NULL)) { + if (!directory_exist(lp_ncalrpc_dir())) { mkdir(lp_ncalrpc_dir(), 0755); } diff --git a/source4/smbd/server.c b/source4/smbd/server.c index 9bf71702f2..c5dee5f7ad 100644 --- a/source4/smbd/server.c +++ b/source4/smbd/server.c @@ -157,7 +157,7 @@ static int binary_smbd_main(int argc, const char *argv[]) cleanup_tmp_files(); - if (!directory_exist(lp_lockdir(), NULL)) { + if (!directory_exist(lp_lockdir())) { mkdir(lp_lockdir(), 0755); } diff --git a/source4/winbind/wb_server.c b/source4/winbind/wb_server.c index c277772e1e..0513b1b125 100644 --- a/source4/winbind/wb_server.c +++ b/source4/winbind/wb_server.c @@ -153,7 +153,7 @@ static void winbind_task_init(struct task_server *task) } /* Make sure the directory for NCALRPC exists */ - if (!directory_exist(WINBINDD_DIR, NULL)) { + if (!directory_exist(WINBINDD_DIR)) { mkdir(WINBINDD_DIR, 0755); } -- cgit