summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-05-07 18:28:24 +0000
committerJeremy Allison <jra@samba.org>2003-05-07 18:28:24 +0000
commitfae80fe1a050b36dbf862ae1ac9170fea247b0a9 (patch)
treeb42b08f513c40197856194126dbf8fd35f3959b0 /source3
parent2752f4a533a5546df794aa7c02f6765185ccc4cc (diff)
downloadsamba-fae80fe1a050b36dbf862ae1ac9170fea247b0a9.tar.gz
samba-fae80fe1a050b36dbf862ae1ac9170fea247b0a9.tar.bz2
samba-fae80fe1a050b36dbf862ae1ac9170fea247b0a9.zip
Make fchown, fchmod conditional for systems that don't have them.
Jeremy. (This used to be commit cf78b1e7fe72aec72d03c86c46a8ca49df539c11)
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/vfs-wrap.c21
-rw-r--r--source3/web/swat.c4
2 files changed, 20 insertions, 5 deletions
diff --git a/source3/smbd/vfs-wrap.c b/source3/smbd/vfs-wrap.c
index bae304096c..491fa70e68 100644
--- a/source3/smbd/vfs-wrap.c
+++ b/source3/smbd/vfs-wrap.c
@@ -298,10 +298,10 @@ int vfswrap_chmod(connection_struct *conn, const char *path, mode_t mode)
int vfswrap_fchmod(files_struct *fsp, int fd, mode_t mode)
{
- int result;
+ int result;
struct vfs_ops *vfs_ops = &fsp->conn->vfs_ops;
- START_PROFILE(syscall_fchmod);
+ START_PROFILE(syscall_fchmod);
/*
* We need to do this due to the fact that the default POSIX ACL
@@ -319,9 +319,15 @@ int vfswrap_fchmod(files_struct *fsp, int fd, mode_t mode)
errno = saved_errno;
}
- result = fchmod(fd, mode);
- END_PROFILE(syscall_fchmod);
- return result;
+#if defined(HAVE_FCHMOD)
+ result = fchmod(fd, mode);
+#else
+ result = -1;
+ errno = ENOSYS;
+#endif
+
+ END_PROFILE(syscall_fchmod);
+ return result;
}
int vfswrap_chown(connection_struct *conn, const char *path, uid_t uid, gid_t gid)
@@ -336,6 +342,7 @@ int vfswrap_chown(connection_struct *conn, const char *path, uid_t uid, gid_t gi
int vfswrap_fchown(files_struct *fsp, int fd, uid_t uid, gid_t gid)
{
+#ifdef HAVE_FCHOWN
int result;
START_PROFILE(syscall_fchown);
@@ -343,6 +350,10 @@ int vfswrap_fchown(files_struct *fsp, int fd, uid_t uid, gid_t gid)
result = fchown(fd, uid, gid);
END_PROFILE(syscall_fchown);
return result;
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
}
int vfswrap_chdir(connection_struct *conn, const char *path)
diff --git a/source3/web/swat.c b/source3/web/swat.c
index fa319bb3ae..7f9492933a 100644
--- a/source3/web/swat.c
+++ b/source3/web/swat.c
@@ -417,7 +417,11 @@ static int save_reload(int snum)
/* just in case they have used the buggy xinetd to create the file */
if (fstat(fileno(f), &st) == 0 &&
(st.st_mode & S_IWOTH)) {
+#if defined HAVE_FCHMOD
fchmod(fileno(f), S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH);
+#else
+ chmod(dyn_CONFIGFILE, S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH);
+#endif
}
write_config(f, False);