diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2012-11-01 18:04:34 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-11-02 21:26:29 +0100 |
commit | d74bef2b04a3ccf7339ba916e56830bb2feae957 (patch) | |
tree | aa40a0a9a72a8f9d68fd552b045410e35368a08f /commands/mount.c | |
parent | 56371f4e8446d04d2a5608dd5890fd87a50f888e (diff) | |
download | barebox-d74bef2b04a3ccf7339ba916e56830bb2feae957.tar.gz barebox-d74bef2b04a3ccf7339ba916e56830bb2feae957.tar.xz |
mount: add compatibility to old mount command
the mount command used to have the syntax 'mount <dev> <type> <mountpoint>'.
This was changed to the more Linux like behaviour which specifies the
type with the -t <type> option. If a newer barebox is run on a device
with an older environment the mount command no longer works. This patch
adds compatibility to the old behaviour.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/mount.c')
-rw-r--r-- | commands/mount.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/commands/mount.c b/commands/mount.c index f339c37173..be26af84ab 100644 --- a/commands/mount.c +++ b/commands/mount.c @@ -33,7 +33,8 @@ static int do_mount(int argc, char *argv[]) int opt; int ret = 0; struct fs_device_d *fsdev; - char *type = NULL; + const char *type = NULL; + const char *mountpoint, *dev; if (argc == 1) { for_each_fs_device(fsdev) { @@ -56,7 +57,19 @@ static int do_mount(int argc, char *argv[]) if (argc < optind + 2) return COMMAND_ERROR_USAGE; - if ((ret = mount(argv[optind], type, argv[optind + 1]))) { + dev = argv[optind]; + + if (argc == optind + 3) { + /* + * Old behaviour: mount <dev> <type> <mountpoint> + */ + type = argv[optind + 1]; + mountpoint = argv[optind + 2]; + } else { + mountpoint = argv[optind + 1]; + } + + if ((ret = mount(dev, type, mountpoint))) { perror("mount"); return 1; } |