On August 15, 2018 4:27:24 PM GMT+02:00, Scott Cheloha <scottchel...@gmail.com> 
wrote:
>Use dprintf for the DEFAULT_MESG string instead of the more awkward
>write+strlen combo.
>
>ok?
>
>--
>Scott Cheloha
>
>Index: sbin/nologin/nologin.c
>===================================================================
>RCS file: /cvs/src/sbin/nologin/nologin.c,v
>retrieving revision 1.7
>diff -u -p -r1.7 nologin.c
>--- sbin/nologin/nologin.c     14 Aug 2018 18:13:11 -0000      1.7
>+++ sbin/nologin/nologin.c     15 Aug 2018 14:07:28 -0000
>@@ -30,7 +30,6 @@
> #include <fcntl.h>
> #include <stdio.h>
> #include <stdlib.h>
>-#include <string.h>
> #include <unistd.h>
> 
> /* Distinctly different from _PATH_NOLOGIN. */
>@@ -52,8 +51,8 @@ main(int argc, char *argv[])
>               err(1, "pledge");
> 
>       nfd = open(_PATH_NOLOGIN_TXT, O_RDONLY);
>-      if (nfd < 0) {
>-              write(STDOUT_FILENO, DEFAULT_MESG, strlen(DEFAULT_MESG));
>+      if (nfd == -1) {
>+              dprintf(STDOUT_FILENO, DEFAULT_MESG);

"%s" at the very least. 

/Alexander 
>               exit (1);
>       }
> 

Reply via email to