bug-gnulib
[Top][All Lists]
Advanced

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

getusershell: Don't completely ignore lines that contain a comment


From: Bruno Haible
Subject: getusershell: Don't completely ignore lines that contain a comment
Date: Tue, 27 Aug 2024 22:17:41 +0200

clang on native Windows gives me this warning:

gllib\getusershell.c(115,25): warning: expression which evaluates to zero 
treated as a null pointer constant of type 'char *' 
[-Wnon-literal-null-conversion]

This patch fixes it. Collin, please consider strengthening the unit test.


2024-08-27  Bruno Haible  <bruno@clisp.org>

        getusershell: Don't completely ignore lines that contain a comment.
        * lib/getusershell.c (getusershell): Truncate the line where a comment
        starts, instead of ignoring the line entirely.

diff --git a/lib/getusershell.c b/lib/getusershell.c
index 356b8023d5..817318327b 100644
--- a/lib/getusershell.c
+++ b/lib/getusershell.c
@@ -112,7 +112,7 @@ getusershell (void)
           if (comment != NULL)
             {
               /* Trim the comment mark.  */
-              comment = '\0';
+              *comment = '\0';
               end = comment;
             }
           else






reply via email to

[Prev in Thread] Current Thread [Next in Thread]