diff mbox

[06/11] ndctl: kill unused code

Message ID 20151015210616.22046.7231.stgit@dwillia2-desk3.jf.intel.com (mailing list archive)
State Accepted
Commit 8a4b15b40139
Headers show

Commit Message

Dan Williams Oct. 15, 2015, 9:06 p.m. UTC
Static analysis points out that nothing uses 'cmd' in ndctl.c::main().

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 ndctl.c |   26 +-------------------------
 1 file changed, 1 insertion(+), 25 deletions(-)
diff mbox

Patch

diff --git a/ndctl.c b/ndctl.c
index 8d806d3adb30..242832af8249 100644
--- a/ndctl.c
+++ b/ndctl.c
@@ -168,32 +168,9 @@  static void handle_internal_command(int argc, const char **argv)
 	}
 }
 
-static const char *to_argv0_path(const char *argv0)
-{
-        const char *slash, *argv0_path;
-
-        if (!argv0 || !*argv0)
-                return NULL;
-        slash = argv0 + strlen(argv0);
-
-        while (argv0 <= slash && !is_dir_sep(*slash))
-                slash--;
-
-        if (slash >= argv0) {
-                argv0_path = strndup(argv0, slash - argv0);
-                return argv0_path ? slash + 1 : NULL;
-        }
-
-        return argv0;
-}
-
 int main(int argc, const char **argv)
 {
-	const char *cmd = to_argv0_path(argv[0]);
-
 	ndctl_usage_string = init_usage_string();
-	if (!cmd)
-		cmd = "ndctl-help";
 
 	/* Look for flags.. */
 	argv++;
@@ -209,10 +186,9 @@  int main(int argc, const char **argv)
 		/* printf("\n %s\n\n", ndctl_more_info_string); TODO */
 		goto out;
 	}
-	cmd = argv[0];
 	handle_internal_command(argc, argv);
 	fprintf(stderr, "Failed to run command '%s': %s\n",
-		cmd, strerror(errno));
+		argv[0], strerror(errno));
 out:
 	return 1;
 }