Re: nologin: Style fixes

2022-11-18 Thread Theo de Raadt
This does not help anything.


Josiah Frentsos  wrote:

> 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 -  1.9
> +++ nologin.c 18 Nov 2022 16:59:31 -
> @@ -25,7 +25,6 @@
>   * SUCH DAMAGE.
>   */
>  
> -#include 
>  #include 
>  #include 
>  #include 
> @@ -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);
>  }
> 



nologin: Style fixes

2022-11-18 Thread Josiah Frentsos
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 -  1.9
+++ nologin.c   18 Nov 2022 16:59:31 -
@@ -25,7 +25,6 @@
  * SUCH DAMAGE.
  */
 
-#include 
 #include 
 #include 
 #include 
@@ -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);
 }