diff options
author | Andrew Bartlett <abartlet@samba.org> | 2002-06-14 06:23:42 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2002-06-14 06:23:42 +0000 |
commit | a8748f886ad6bda17cf97d2e7baaa2968cf5f696 (patch) | |
tree | 136a6362fc58da2296f932018582f9c641b93e0a /source3/passdb/pdb_smbpasswd.c | |
parent | f1b393ce11245fb7bc4488a5377fa516fb4ae17a (diff) | |
download | samba-a8748f886ad6bda17cf97d2e7baaa2968cf5f696.tar.gz samba-a8748f886ad6bda17cf97d2e7baaa2968cf5f696.tar.bz2 samba-a8748f886ad6bda17cf97d2e7baaa2968cf5f696.zip |
It looks like we never tested the 'cleanup' code, so when I triggered it
(invalid passdb backends smb.conf entry) we picked up a few things :-).
Andrew Bartlett
(This used to be commit dfa98ae0ac195956490ca2f4140a8eff1566095e)
Diffstat (limited to 'source3/passdb/pdb_smbpasswd.c')
-rw-r--r-- | source3/passdb/pdb_smbpasswd.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/source3/passdb/pdb_smbpasswd.c b/source3/passdb/pdb_smbpasswd.c index 25957100d8..09277e2d23 100644 --- a/source3/passdb/pdb_smbpasswd.c +++ b/source3/passdb/pdb_smbpasswd.c @@ -101,6 +101,10 @@ static BOOL pw_file_unlock(int fd, int *plock_depth) { BOOL ret=True; + if (fd == 0 || *plock_depth == 0) { + return True; + } + if(*plock_depth == 1) ret = do_file_lock(fd, 5, F_UNLCK); @@ -264,10 +268,13 @@ Error was %s\n.", pfile, strerror(errno) )); ****************************************************************/ static void endsmbfilepwent(FILE *fp, int *lock_depth) { + if (!fp) { + return; + } - pw_file_unlock(fileno(fp), lock_depth); - fclose(fp); - DEBUG(7, ("endsmbfilepwent_internal: closed password file.\n")); + pw_file_unlock(fileno(fp), lock_depth); + fclose(fp); + DEBUG(7, ("endsmbfilepwent_internal: closed password file.\n")); } /************************************************************************* |