]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journalctl: replace string_erase with memset('x') 5237/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 6 Feb 2017 01:09:41 +0000 (20:09 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 6 Feb 2017 02:07:55 +0000 (21:07 -0500)
The compiler should not be able to optimize out the memset, because optarg is global
memory. In this case, not making the argument an empty string is nicer, so just use
an open-coded version of string_erase from before the explicit_bzero change.

src/journal/journalctl.c

index 2639fd6cf5ac4077a9066045e95a1041c6b87c15..9ad6f115a19b0598f1383b143cde0f6e09ca2c79 100644 (file)
@@ -686,7 +686,9 @@ static int parse_argv(int argc, char *argv[]) {
                         r = free_and_strdup(&arg_verify_key, optarg);
                         if (r < 0)
                                 return r;
-                        string_erase(optarg);
+                        /* Use memset not string_erase so this doesn't look confusing
+                         * in ps or htop output. */
+                        memset(optarg, 'x', strlen(optarg));
 
                         arg_merge = false;
                         break;