fopen returns pointer, not integer; fix for ANSI C
[unix-history] / usr / src / usr.bin / login / login.c
index 926be83..d83752a 100644 (file)
@@ -11,7 +11,7 @@ char copyright[] =
 #endif not lint
 
 #ifndef lint
 #endif not lint
 
 #ifndef lint
-static char sccsid[] = "@(#)login.c    5.21 (Berkeley) %G%";
+static char sccsid[] = "@(#)login.c    5.23 (Berkeley) %G%";
 #endif not lint
 
 /*
 #endif not lint
 
 /*
@@ -263,7 +263,7 @@ main(argc, argv)
                /*
                 * If user not super-user, check for logins disabled.
                 */
                /*
                 * If user not super-user, check for logins disabled.
                 */
-               if (pwd->pw_uid != 0 && (nlfd = fopen(nolog, "r")) > 0) {
+               if (pwd->pw_uid != 0 && (nlfd = fopen(nolog, "r"))) {
                        while ((c = getc(nlfd)) != EOF)
                                putchar(c);
                        fflush(stdout);
                        while ((c = getc(nlfd)) != EOF)
                                putchar(c);
                        fflush(stdout);
@@ -337,17 +337,8 @@ main(argc, argv)
                exit(0);
        }
        time(&utmp.ut_time);
                exit(0);
        }
        time(&utmp.ut_time);
-       t = ttyslot();
-       if (t > 0 && (f = open("/etc/utmp", O_WRONLY)) >= 0) {
-               lseek(f, (long)(t*sizeof(utmp)), 0);
-               SCPYN(utmp.ut_line, tty);
-               write(f, (char *)&utmp, sizeof(utmp));
-               close(f);
-       }
-       if ((f = open("/usr/adm/wtmp", O_WRONLY|O_APPEND)) >= 0) {
-               write(f, (char *)&utmp, sizeof(utmp));
-               close(f);
-       }
+       SCPYN(utmp.ut_line, tty);
+       login(&utmp);
        quietlog = access(qlog, F_OK) == 0;
        if ((f = open(lastlog, O_RDWR)) >= 0) {
                struct lastlog ll;
        quietlog = access(qlog, F_OK) == 0;
        if ((f = open(lastlog, O_RDWR)) >= 0) {
                struct lastlog ll;