summaryrefslogtreecommitdiffstats
path: root/source4/lib/util.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-02-10 06:36:30 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:09:39 -0500
commit35537c1255e9508b77fd9d9def1ac96e423bee46 (patch)
treef140c802a98188f13c891c02332d7604a71f45e3 /source4/lib/util.c
parentf9529111af758191c0c3ad5794ea9a5fe1e2a59b (diff)
downloadsamba-35537c1255e9508b77fd9d9def1ac96e423bee46.tar.gz
samba-35537c1255e9508b77fd9d9def1ac96e423bee46.tar.xz
samba-35537c1255e9508b77fd9d9def1ac96e423bee46.zip
r5302: fixed a compilation problem on solaris caused by the recent include
changes (This used to be commit e7e015f79b10c353848a17f31c91a0593790a560)
Diffstat (limited to 'source4/lib/util.c')
-rw-r--r--source4/lib/util.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/source4/lib/util.c b/source4/lib/util.c
index af41a20aa57..d95924670f6 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);
}