From a2e02ac80845e7c54092e1cc0198c934838c77f4 Mon Sep 17 00:00:00 2001 From: Philipp Zabel Date: Tue, 30 May 2017 16:09:44 +0200 Subject: 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 Signed-off-by: Sascha Hauer --- commands/mount.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/commands/mount.c b/commands/mount.c index aa769d46fe..f05e23b227 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 @@ -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) -- cgit v1.2.3