summaryrefslogtreecommitdiffstats
path: root/isys/imount.c
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2008-03-14 18:18:59 -0400
committerChris Lumens <clumens@redhat.com>2008-03-14 18:18:59 -0400
commit45e459761df8722b470b10cc656b301e78b7a2e2 (patch)
tree7d2f3ac1ae4acc66304e0ccd119f23e389da1744 /isys/imount.c
parent3e7ccb8ade02780e704c2fa969ebfe256d26258e (diff)
downloadanaconda-45e459761df8722b470b10cc656b301e78b7a2e2.tar.gz
anaconda-45e459761df8722b470b10cc656b301e78b7a2e2.tar.xz
anaconda-45e459761df8722b470b10cc656b301e78b7a2e2.zip
Accept devices with or without a leading /dev/.
Diffstat (limited to 'isys/imount.c')
-rw-r--r--isys/imount.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/isys/imount.c b/isys/imount.c
index 434fc61bd..ae47f7c65 100644
--- a/isys/imount.c
+++ b/isys/imount.c
@@ -36,7 +36,7 @@ static int mkdirIfNone(char * directory);
int doPwMount(char *dev, char *where, char *fs, char *options) {
int rc, child, status;
- char *opts = NULL;
+ char *opts = NULL, *device;
if (mkdirChain(where)) {
return IMOUNT_ERR_ERRNO;
@@ -52,6 +52,11 @@ int doPwMount(char *dev, char *where, char *fs, char *options) {
opts = strdup(options);
}
+ if (*dev != '/')
+ rc = asprintf(&device, "/dev/%s", dev);
+ else
+ device = strdup(dev);
+
if (!(child = fork())) {
int fd;
@@ -72,11 +77,11 @@ int doPwMount(char *dev, char *where, char *fs, char *options) {
if (opts) {
rc = execl("/bin/mount",
- "/bin/mount", "-n", "-t", fs, "-o", opts, dev, where, NULL);
+ "/bin/mount", "-n", "-t", fs, "-o", opts, device, where, NULL);
exit(1);
}
else {
- rc = execl("/bin/mount", "/bin/mount", "-n", "-t", fs, dev, where, NULL);
+ rc = execl("/bin/mount", "/bin/mount", "-n", "-t", fs, device, where, NULL);
exit(1);
}
}
@@ -84,6 +89,7 @@ int doPwMount(char *dev, char *where, char *fs, char *options) {
waitpid(child, &status, 0);
free(opts);
+ free(device);
if (!WIFEXITED(status) || (WIFEXITED(status) && WEXITSTATUS(status)))
return IMOUNT_ERR_OTHER;