]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
Include libgen.h for basename prototype.
authorWarner Losh <imp@bsdimp.com>
Thu, 4 Oct 2018 05:29:04 +0000 (23:29 -0600)
committerWarner Losh <imp@bsdimp.com>
Thu, 4 Oct 2018 05:43:34 +0000 (23:43 -0600)
Also, convert open_dev to take a char * and remove the cast from where
it's called. basenmae takes a char * and modifies the string. In this
case, such modifications are fine and only the const char * type was
in error.

nvme.c

diff --git a/nvme.c b/nvme.c
index a239322a4d3d540718b236ea7ccea9a90cc93eb0..e2f4abc93c55d3e63e8dc4dba7549efd2cb5b162 100644 (file)
--- a/nvme.c
+++ b/nvme.c
@@ -36,6 +36,7 @@
 #include <unistd.h>
 #include <math.h>
 #include <dirent.h>
+#include <libgen.h>
 
 #include <linux/fs.h>
 
@@ -92,7 +93,7 @@ static unsigned long long elapsed_utime(struct timeval start_time,
        return ret;
 }
 
-static int open_dev(const char *dev)
+static int open_dev(char *dev)
 {
        int err, fd;
 
@@ -133,7 +134,7 @@ static int get_dev(int argc, char **argv)
        if (ret)
                return ret;
 
-       return open_dev((const char *)argv[optind]);
+       return open_dev(argv[optind]);
 }
 
 int parse_and_open(int argc, char **argv, const char *desc,