All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] getgrouplist.3: tfix in example
@ 2024-03-06 16:13 Fedor Lapshin
  2024-03-16  0:27 ` Alejandro Colomar
  0 siblings, 1 reply; 5+ messages in thread
From: Fedor Lapshin @ 2024-03-06 16:13 UTC (permalink / raw)
  To: alx; +Cc: linux-man

In example of getgrouplist, if getpwnam returns NULL, the program
exits. The exit code EXIT_SUCCESS looks like a mistake, since the
program also calls perror right before.

This patch changes the exit code to EXIT_FAILURE.

Best regards, Fedor.

---
 man3/getgrouplist.3 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/man3/getgrouplist.3 b/man3/getgrouplist.3
index 41389b6c3..239913ce6 100644
--- a/man3/getgrouplist.3
+++ b/man3/getgrouplist.3
@@ -165,7 +165,7 @@ main(int argc, char *argv[])
     pw = getpwnam(argv[1]);
     if (pw == NULL) {
         perror("getpwnam");
-        exit(EXIT_SUCCESS);
+        exit(EXIT_FAILURE);
     }
 \&
     /* Retrieve group list. */
-- 
2.34.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-03-27 20:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-06 16:13 [patch] getgrouplist.3: tfix in example Fedor Lapshin
2024-03-16  0:27 ` Alejandro Colomar
2024-03-27 19:20   ` [PATCH] getgrouplist.3: EXAMPLES: fix error handling for getpwnam(3) Fedor Lapshin
2024-03-27 19:23     ` Fedor Lapshin
2024-03-27 20:14       ` Alejandro Colomar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.