]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
main: Quiet compiler warning about free(const char *)
authorColin Walters <walters@verbum.org>
Tue, 25 Sep 2012 19:01:54 +0000 (15:01 -0400)
committerRay Strode <rstrode@redhat.com>
Tue, 25 Sep 2012 19:08:29 +0000 (15:08 -0400)
Just make a duplicate variable.

src/main.c

index e1583bc910dcdb1ef0261a0614bc5e8860dfcec7..88e50025084fb8967637c7e3ef63748b35765b5c 100644 (file)
@@ -1857,23 +1857,24 @@ check_verbosity (state_t *state)
       if (stream != NULL)
         {
           char *end;
+          char *stream_copy;
 
-          stream = strdup (stream);
-          end = stream + strcspn (stream, " \n");
+          stream_copy = strdup (stream);
+          end = stream_copy + strcspn (stream_copy, " \n");
           *end = '\0';
 
-          ply_trace ("streaming debug output to %s instead of screen", stream);
-          fd = open (stream, O_RDWR | O_NOCTTY | O_CREAT, 0600);
+          ply_trace ("streaming debug output to %s instead of screen", stream_copy);
+          fd = open (stream_copy, O_RDWR | O_NOCTTY | O_CREAT, 0600);
 
           if (fd < 0)
             {
-              ply_trace ("could not stream output to %s: %m", stream);
+              ply_trace ("could not stream output to %s: %m", stream_copy);
             }
           else
             {
               ply_logger_set_output_fd (ply_logger_get_error_default (), fd);
             }
-          free (stream);
+          free (stream_copy);
         }
     }
   else