vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hello, tech@. Following diff contains following changes to nologin.c: 1) Remove unused header file <sys/types.h> due to man page error (write(2) does not need <sys/types.h>) 2) main() arguments are not used. 3) Remove extra spaces between function name and open bracket (e.g exit (1) -> exit(1); ) --- nologin.c.original Fri Jul 27 19:09:38 2007 +++ nologin.c Fri Jul 27 19:09:13 2007 @@ -25,34 +25,33 @@ * SUCH DAMAGE. */ -#include <sys/types.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> -/* Distinctly different from _PATH_NOLOGIN. */ -#define _PATH_NOLOGIN_TXT "/etc/nologin.txt" - -#define DEFAULT_MESG "This account is currently not available.\n" - -/*ARGSUSED*/ -int main(int argc, char *argv[]) +int +main(void) { int nfd; ssize_t nrd; char nbuf[BUFSIZ]; +/* Distinctly different from _PATH_NOLOGIN. */ +#define _PATH_NOLOGIN_TXT "/etc/nologin.txt" +#define DEFAULT_MESG "This account is currently not available.\n" + nfd = open(_PATH_NOLOGIN_TXT, O_RDONLY); if (nfd < 0) { write(STDOUT_FILENO, DEFAULT_MESG, strlen(DEFAULT_MESG)); - exit (1); + exit(1); } while ((nrd = read(nfd, nbuf, sizeof(nbuf))) != -1 && nrd != 0) write(STDOUT_FILENO, nbuf, nrd); - close (nfd); - exit (1); + close(nfd); + + exit(1); } |