vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Well now it happened. Yesterdaynight I had a dream and in this dream an angel came to me and he revelled to me how I aught to change the code of /sbin/nologin as the lord demands it. Lo and behold his commands. Tremble thou mortals! Index: Makefile ================================================== ================= RCS file: /cvs/src/sbin/nologin/Makefile,v retrieving revision 1.5 diff -u -p -r1.5 Makefile --- Makefile 16 Feb 1997 04:15:31 -0000 1.5 +++ Makefile 13 May 2005 08:50:57 -0000 @@ -3,4 +3,6 @@ PROG= nologin MAN= nologin.8 +CFLAGS+=-Wall -pedantic + .include <bsd.prog.mk> Index: nologin.c ================================================== ================= RCS file: /cvs/src/sbin/nologin/nologin.c,v retrieving revision 1.5 diff -u -p -r1.5 nologin.c --- nologin.c 10 Jul 2003 00:00:58 -0000 1.5 +++ nologin.c 13 May 2005 08:50:57 -0000 @@ -28,7 +28,6 @@ #include <sys/types.h> #include <fcntl.h> #include <stdio.h> -#include <stdlib.h> #include <string.h> #include <unistd.h> @@ -40,19 +39,19 @@ /*ARGSUSED*/ int main(int argc, char *argv[]) { - int nfd; + int nfd; ssize_t nrd; - char nbuf[BUFSIZ]; + char nbuf[BUFSIZ]; nfd = open(_PATH_NOLOGIN_TXT, O_RDONLY); - if (nfd < 0) { - write(STDOUT_FILENO, DEFAULT_MESG, strlen(DEFAULT_MESG)); - exit (1); + if (nfd == -1) { + write(STDERR_FILENO, DEFAULT_MESG, strlen(DEFAULT_MESG)); + return 1; } while ((nrd = read(nfd, nbuf, sizeof(nbuf))) != -1 && nrd != 0) - write(STDOUT_FILENO, nbuf, nrd); - close (nfd); + write(STDERR_FILENO, nbuf, nrd); - exit (1); + close (nfd); + return 1; } # Han |