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.
#include <unistd.h>
#include <math.h>
#include <dirent.h>
+#include <libgen.h>
#include <linux/fs.h>
return ret;
}
-static int open_dev(const char *dev)
+static int open_dev(char *dev)
{
int err, fd;
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,