This is a discussion on Re: Shouldn't /sbin/nologin send the message to stderr? within the mailing.openbsd.tech forums, part of the OpenBSD category; --> Alright. Then it all boils down to those two patches: The first is the functional changes, second is for ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Alright. Then it all boils down to those two patches: The first is the functional changes, second is for the layout. 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 13:26:19 -0000 @@ -28,7 +28,6 @@ #include <sys/types.h> #include <fcntl.h> #include <stdio.h> -#include <stdlib.h> #include <string.h> #include <unistd.h> @@ -45,14 +44,14 @@ int main(int argc, char *argv[]) char nbuf[BUFSIZ]; nfd = open(_PATH_NOLOGIN_TXT, O_RDONLY); - if (nfd < 0) { + if (nfd == -1) { write(STDOUT_FILENO, DEFAULT_MESG, strlen(DEFAULT_MESG)); - exit (1); + return (1); } while ((nrd = read(nfd, nbuf, sizeof(nbuf))) != -1 && nrd != 0) write(STDOUT_FILENO, nbuf, nrd); close (nfd); - exit (1); + return (1); } --- nologin.c Fri May 13 15:29:02 2005 +++ nologin.c.bak Fri May 13 15:30:02 2005 @@ -37,11 +37,12 @@ #define DEFAULT_MESG "This account is currently not available.\n" /*ARGSUSED*/ -int main(int argc, char *argv[]) +int +main(int argc, char *argv[]) { - int nfd; - ssize_t nrd; - char nbuf[BUFSIZ]; + int nfd; + ssize_t nrd; + char nbuf[BUFSIZ]; nfd = open(_PATH_NOLOGIN_TXT, O_RDONLY); if (nfd == -1) { @@ -51,7 +52,7 @@ while ((nrd = read(nfd, nbuf, sizeof(nbuf))) != -1 && nrd != 0) write(STDOUT_FILENO, nbuf, nrd); - close (nfd); + close(nfd); return (1); } # Han -- ( homepage : http://www.xs4all.nl/~hanb _______ )) pgpkey : http://www.xs4all.nl/~hanb/keys/Han_pubkey.gpg > ====<--. C|~~| email : h a n @ m i j n c o m p u t e r . n l | = |-' `--' irc : irc.freenode.net#UnixNL `------' |