X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fvdevmap.c;h=1a9c9a417cfa2e99b807315e1dfa6d0fa3cdbf05;hb=1cf33b33576848a1da7f3d43792e56f1c702459d;hp=4019c1918d7e66f25beba773e67d1e28ccd4a738;hpb=636875649376f36e02848dde1c1017a119b4fff4;p=util-vserver.git diff --git a/src/vdevmap.c b/src/vdevmap.c index 4019c19..1a9c9a4 100644 --- a/src/vdevmap.c +++ b/src/vdevmap.c @@ -85,6 +85,7 @@ int main(int argc, char *argv[]) uint32_t flags = 0; char *device = NULL; char *target = NULL; + unsigned long tmp = 0; while (1) { int c = getopt_long(argc, argv, "+x:ocrf:d:t:", CMDLINE_OPTIONS, 0); @@ -100,12 +101,13 @@ int main(int argc, char *argv[]) case 'd' : device = optarg; break; case 't' : target = optarg; break; case 'f' : - if (!isNumberUnsigned(optarg, &flags, false)) { + if (!isNumberUnsigned(optarg, &tmp, false)) { WRITE_MSG(2, "Invalid flags argument: '"); WRITE_STR(2, optarg); WRITE_MSG(2, "'; try '--help' for more information\n"); return EXIT_FAILURE; } + flags |= (uint32_t) tmp; break; default : @@ -123,6 +125,8 @@ int main(int argc, char *argv[]) if (xid==VC_NOCTX) WRITE_MSG(2, "No xid specified; try '--help' for more information\n"); + else if (optind!=argc) + WRITE_MSG(2, "Unused argument(s); try '--help' for more information\n"); else if (vc_set_mapping(xid, device, target, flags)==-1) perror("vc_set_mapping()"); else