public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] man/man3/strftime.3: Check parameter
@ 2025-08-18 16:56 dave
  2025-08-18 17:14 ` Alejandro Colomar
  0 siblings, 1 reply; 3+ messages in thread
From: dave @ 2025-08-18 16:56 UTC (permalink / raw)
  To: alx; +Cc: linux-man, Dr. David Alan Gilbert

From: "Dr. David Alan Gilbert" <dave@treblig.org>

The strftime example requires a format paramter.  If you don't
pass one it crashes.
Check for the parameter.

Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
---
 man/man3/strftime.3 | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/man/man3/strftime.3 b/man/man3/strftime.3
index 4a3f805bb..3c1108b36 100644
--- a/man/man3/strftime.3
+++ b/man/man3/strftime.3
@@ -739,6 +739,11 @@ .SS Program source
     char outstr[200];
     time_t t;
     struct tm *tmp;
+\&
+    if (argc != 2) {
+        fprintf(stderr,"%s: format-string\[rs]n", argv[0]);
+        exit(EXIT_FAILURE);
+    }
 \&
     t = time(NULL);
     tmp = localtime(&t);
-- 
2.50.1


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

end of thread, other threads:[~2025-08-18 17:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-18 16:56 [PATCH] man/man3/strftime.3: Check parameter dave
2025-08-18 17:14 ` Alejandro Colomar
2025-08-18 17:46   ` Dr. David Alan Gilbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox