return False;
}
- return ((ret == 0) ? True : False);
+ return (ret == 0);
}
static int pw_file_lock_depth;
(*plock_depth)--;
- if(ret == False)
+ if(!ret)
DEBUG(10,("pw_file_unlock: unlocking file failed, error = %s.\n",
strerror(errno)));
return ret;
/* Set a 16k buffer to do more efficient reads */
setvbuf(fp, s_readbuf, _IOFBF, sizeof(s_readbuf));
- if ((pw_file_lock(fileno(fp), F_RDLCK | (update ? F_WRLCK : 0), 5, &pw_file_lock_depth)) == False) {
+ if (!pw_file_lock(fileno(fp), F_RDLCK | (update ? F_WRLCK : 0), 5, &pw_file_lock_depth))
+ {
DEBUG(0, ("startsmbpwent: unable to lock file %s\n", pfile));
fclose(fp);
return NULL;
lockfd = fileno(fp);
- if (pw_file_lock(lockfd, F_RDLCK | F_WRLCK, 5, &pw_file_lock_depth) == False) {
+ if (!pw_file_lock(lockfd, F_RDLCK | F_WRLCK, 5, &pw_file_lock_depth)) {
DEBUG(0, ("mod_smbpwd_entry: unable to lock file %s\n", pfile));
fclose(fp);
return False;
char *p;
if(mach_passwd_lock_depth == 0) {
+
pstrcpy(mac_file, lp_smb_passwd_file());
p = strrchr(mac_file, '/');
+
if(p != NULL)
*++p = '\0';
+
mac_file_len = strlen(mac_file);
- if(sizeof(pstring) - mac_file_len - strlen(domain) - strlen(name) - 6) {
+
+ if (sizeof(pstring) - mac_file_len - strlen(domain) - strlen(name) - 6 < 0)
+ {
DEBUG(0,("machine_password_lock: path %s too long to add machine details.\n",
mac_file));
return NULL;
strcat(mac_file, name);
strcat(mac_file, ".mac");
- if((fp = fopen(mac_file, "r+b")) == 0) {
- DEBUG(0,("machine_password_lock: cannot open file %s. Error was %s.\n",
+ if((fp = fopen(mac_file, "r+b")) == NULL) {
+ DEBUG(0,("machine_password_lock: cannot open file %s - Error was %s.\n",
mac_file, strerror(errno) ));
return NULL;
}
chmod(mac_file, 0600);
}
- if(pw_file_lock(fileno(fp), F_RDLCK | (update ? F_WRLCK : 0),
- 60, &mach_passwd_lock_depth) == False) {
- DEBUG(0,("machine_password_lock: cannot lock file %s.\n", mac_file));
+ if(!pw_file_lock(fileno(fp), F_RDLCK | (update ? F_WRLCK : 0),
+ 60, &mach_passwd_lock_depth))
+ {
+ DEBUG(0,("machine_password_lock: cannot lock file %s\n", mac_file));
fclose(fp);
return NULL;
}