Portability fix from schmitz@hp.com (Joachim Schmitz). Bug #547.
authorJeremy Allison <jra@samba.org>
Thu, 2 Oct 2003 17:53:57 +0000 (17:53 +0000)
committerJeremy Allison <jra@samba.org>
Thu, 2 Oct 2003 17:53:57 +0000 (17:53 +0000)
Jeremy.
(This used to be commit bbc7b189b9b4b3a5ef0a5ddbb7d2d755f6341fdf)

source3/passdb/pdb_smbpasswd.c

index 8171b65adcce106cbae27e59e8e5ae0cfbe44e61..8cdbec9b9d00188a8ff7af8b345a8aba00315f3a 100644 (file)
@@ -261,7 +261,11 @@ static FILE *startsmbfilepwent(const char *pfile, enum pwf_access_type type, int
   setvbuf(fp, (char *)NULL, _IOFBF, 1024);
 
   /* Make sure it is only rw by the owner */
+#ifdef HAVE_FCHMOD
   if(fchmod(fileno(fp), S_IRUSR|S_IWUSR) == -1) {
+#else
+  if(chmod(pfile, S_IRUSR|S_IWUSR) == -1) {
+#endif
     DEBUG(0, ("startsmbfilepwent_internal: failed to set 0600 permissions on password file %s. \
 Error was %s\n.", pfile, strerror(errno) ));
     pw_file_unlock(fileno(fp), lock_depth);