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);
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);
pstring remote_name;
fstring buf;
char *p = buf;
- struct stat st;
pstrcpy(remote_name, cur_dir);
pstrcat(remote_name, "\\");
}
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;
}
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.",
/*******************************************************************
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)));
}
/*******************************************************************
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;
dname = talloc_strdup(mem_ctx, lp_lockdir());
trim_string(dname,"","/");
- if (!directory_exist(dname,NULL)) {
+ if (!directory_exist(dname)) {
mkdir(dname,0755);
}
char *fname, *dname;
dname = lock_path(mem_ctx, "smbd.tmp");
- if (!directory_exist(dname,NULL)) {
+ if (!directory_exist(dname)) {
mkdir(dname,0755);
}
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));
}
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;
-}
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
*/
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));
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);
}
cleanup_tmp_files();
- if (!directory_exist(lp_lockdir(), NULL)) {
+ if (!directory_exist(lp_lockdir())) {
mkdir(lp_lockdir(), 0755);
}
}
/* Make sure the directory for NCALRPC exists */
- if (!directory_exist(WINBINDD_DIR, NULL)) {
+ if (!directory_exist(WINBINDD_DIR)) {
mkdir(WINBINDD_DIR, 0755);
}