diff options
| -rw-r--r-- | man/man3/getutent.3 | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/man/man3/getutent.3 b/man/man3/getutent.3 index 656a52cd26..b783f9f59a 100644 --- a/man/man3/getutent.3 +++ b/man/man3/getutent.3 @@ -308,6 +308,7 @@ and .P .\" SRC BEGIN (getutent.c) .EX +#include <err.h> #include <pwd.h> #include <stdlib.h> #include <string.h> @@ -320,7 +321,8 @@ main(void) { struct utmp entry; \& - system("echo before adding entry:;who"); + if (system("echo before adding entry:;who") == \-1) + err(EXIT_FAILURE, "system"); \& entry.ut_type = USER_PROCESS; entry.ut_pid = getpid(); @@ -332,18 +334,22 @@ main(void) memset(entry.ut_host, 0, UT_HOSTSIZE); entry.ut_addr = 0; setutent(); - pututline(&entry); + if (pututline(&entry) == NULL) + err(EXIT_FAILURE, "pututline"); \& - system("echo after adding entry:;who"); + if (system("echo after adding entry:;who") == \-1) + err(EXIT_FAILURE, "system"); \& entry.ut_type = DEAD_PROCESS; memset(entry.ut_line, 0, UT_LINESIZE); entry.ut_time = 0; memset(entry.ut_user, 0, UT_NAMESIZE); setutent(); - pututline(&entry); + if (pututline(&entry) == NULL) + err(EXIT_FAILURE, "pututline"); \& - system("echo after removing entry:;who"); + if (system("echo after removing entry:;who") == \-1) + err(EXIT_FAILURE, "system"); \& endutent(); exit(EXIT_SUCCESS); |
