[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Shouldn't /sbin/nologin send the message to stderr?



Hi,

After a user question about security I noticed that nologin send
the errormessage to stdout. Shouldn't /sbin/nologin send the
message to stderr? Or if it's really the intention to send the
message to stdout perhaps it would be a good idea to add a small
comment about that to the code.


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	12 May 2005 21:52:41 -0000
@@ -46,12 +46,12 @@ int main(int argc, char *argv[])
 
 	nfd = open(_PATH_NOLOGIN_TXT, O_RDONLY);
 	if (nfd < 0) {
-		write(STDOUT_FILENO, DEFAULT_MESG, strlen(DEFAULT_MESG));
+		write(STDERR_FILENO, DEFAULT_MESG, strlen(DEFAULT_MESG));
 		exit (1);
 	}
 
 	while ((nrd = read(nfd, nbuf, sizeof(nbuf))) != -1 && nrd != 0)
-		write(STDOUT_FILENO, nbuf, nrd);
+		write(STDERR_FILENO, nbuf, nrd);
 	close (nfd);
 
 	exit (1);




# Han



Visit your host, monkey.org