Index: nologin.c
===================================================================
RCS file: /cvs/src/sbin/nologin/nologin.c,v
retrieving revision 1.9
diff -u -p -r1.9 nologin.c
--- nologin.c 12 Jul 2021 15:09:19 -0000 1.9
+++ nologin.c 18 Nov 2022 16:59:31 -0000
@@ -25,7 +25,6 @@
* SUCH DAMAGE.
*/
-#include <sys/types.h>
#include <err.h>
#include <fcntl.h>
#include <stdio.h>
@@ -38,7 +37,6 @@
#define DEFAULT_MESG "This account is currently not available.\n"
-/*ARGSUSED*/
int
main(int argc, char *argv[])
{
@@ -51,15 +49,15 @@ main(int argc, char *argv[])
if (pledge("stdio rpath", NULL) == -1)
err(1, "pledge");
- nfd = open(_PATH_NOLOGIN_TXT, O_RDONLY);
- if (nfd == -1) {
+ if ((nfd = open(_PATH_NOLOGIN_TXT, O_RDONLY)) == -1) {
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);
}