Changeset 1770 in MondoRescue for branches/stable/mindi-busybox/coreutils/logname.c
- Timestamp:
- Nov 6, 2007, 11:01:53 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mindi-busybox/coreutils/logname.c
r821 r1770 21 21 */ 22 22 23 #include <stdio.h> 24 #include <stdlib.h> 25 #include <unistd.h> 26 #include "busybox.h" 23 #include "libbb.h" 27 24 25 /* This is a NOFORK applet. Be very careful! */ 26 27 int logname_main(int argc, char ATTRIBUTE_UNUSED **argv); 28 28 int logname_main(int argc, char ATTRIBUTE_UNUSED **argv) 29 29 { 30 c onst char *p;30 char buf[128]; 31 31 32 32 if (argc > 1) { … … 34 34 } 35 35 36 if ((p = getlogin()) != NULL) { 37 puts(p); 38 bb_fflush_stdout_and_exit(EXIT_SUCCESS); 36 /* Using _r function - avoid pulling in static buffer from libc */ 37 if (getlogin_r(buf, sizeof(buf)) == 0) { 38 puts(buf); 39 return fflush(stdout); 39 40 } 40 41
Note:
See TracChangeset
for help on using the changeset viewer.