diff options
Diffstat (limited to 'src/utmp.c')
-rw-r--r-- | src/utmp.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -181,7 +181,7 @@ remove_utmp_entry(void) setutent(); strncpy(utmp.ut_id, ut_id, sizeof(utmp.ut_id)); utmp.ut_type = USER_PROCESS; - if (getutid(&utmp) == NULL) { + if (!getutid(&utmp)) { return; } utmp.ut_type = DEAD_PROCESS; @@ -204,7 +204,7 @@ remove_utmp_entry(void) * The following code waw copied from the poeigl-1.20 login/init package. * Special thanks to poe for the code examples. */ - while ((putmp = getutent()) != NULL) { + while ((putmp = getutent())) { if (putmp->ut_pid == pid) { putmp->ut_type = DEAD_PROCESS; putmp->ut_pid = 0; @@ -286,10 +286,10 @@ get_tslot(const char *ttyname) char buf[256], name[256]; FILE *fd; - if ((fd = fopen(UTMP_FILENAME, "r")) != NULL) { + if ((fd = fopen(UTMP_FILENAME, "r"))) { int i; - for (i = 1; fgets(buf, sizeof(buf), fd) != NULL; i++) { + for (i = 1; fgets(buf, sizeof(buf), fd); i++) { if (*buf == '#' || sscanf(buf, "%s", name) != 1) continue; if (!strcmp(ttyname, name)) { @@ -313,7 +313,7 @@ write_utmp(struct utmp *putmp) fprintf(stderr, "Utmp file is %s\n", UTMP_FILENAME); privileges(INVOKE); - if ((fd = fopen(UTMP_FILENAME, "r+")) != NULL) { + if ((fd = fopen(UTMP_FILENAME, "r+"))) { utmp_pos = get_tslot(putmp->ut_line) * sizeof(struct utmp); if (utmp_pos >= 0) { @@ -384,7 +384,7 @@ remove_utmp_entry(void) FILE *fd; privileges(INVOKE); - if (!ut_id[0] && (fd = fopen(UTMP_FILENAME, "r+")) != NULL) { + if (!ut_id[0] && (fd = fopen(UTMP_FILENAME, "r+"))) { struct utmp utmp; MEMSET(&utmp, 0, sizeof(struct utmp)); |