summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Zabel <p.zabel@pengutronix.de>2017-05-30 16:09:44 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-06-01 08:31:49 +0200
commita2e02ac80845e7c54092e1cc0198c934838c77f4 (patch)
tree8c987695da5894549b608d7fae2d0cf462327f07
parent46188f4174ff4f1e0f6da76cfcf06521b6350794 (diff)
downloadbarebox-a2e02ac80845e7c54092e1cc0198c934838c77f4.tar.gz
commands: mount: combine dev and devstr, which are the same
Unify the device path used by the default mount and mount with specified mount point paths. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--commands/mount.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/commands/mount.c b/commands/mount.c
index aa769d4..f05e23b 100644
--- a/commands/mount.c
+++ b/commands/mount.c
@@ -29,7 +29,7 @@ static int do_mount(int argc, char *argv[])
int opt, verbose = 0;
struct driver_d *drv;
const char *type = NULL;
- const char *mountpoint, *dev;
+ const char *mountpoint, *devstr;
const char *fsoptions = NULL;
while ((opt = getopt(argc, argv, "ao:t:v")) > 0) {
@@ -70,11 +70,11 @@ static int do_mount(int argc, char *argv[])
return 0;
}
+ devstr = argv[optind];
+
if (argc == optind + 1) {
struct cdev *cdev;
- const char *path, *devstr;
-
- devstr = argv[optind];
+ const char *path;
if (!strncmp(devstr, "/dev/", 5))
devstr += 5;
@@ -97,8 +97,6 @@ static int do_mount(int argc, char *argv[])
if (argc < optind + 2)
return COMMAND_ERROR_USAGE;
- dev = argv[optind];
-
if (argc == optind + 3) {
/*
* Old behaviour: mount <dev> <type> <mountpoint>
@@ -109,7 +107,7 @@ static int do_mount(int argc, char *argv[])
mountpoint = argv[optind + 1];
}
- return mount(dev, type, mountpoint, fsoptions);
+ return mount(devstr, type, mountpoint, fsoptions);
}
BAREBOX_CMD_HELP_START(mount)