From: Francesco Cosoleto Date: Wed, 28 Sep 2011 14:25:31 +0000 (+0200) Subject: ipcrm: fix wrong subject in error messages for -m, -q, -s id options X-Git-Tag: v2.21-rc1~372 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d916761f3e06fad1af40c3ffa738cdde0da65774;p=thirdparty%2Futil-linux.git ipcrm: fix wrong subject in error messages for -m, -q, -s id options This makes error messages print 'id' instead of 'key' using id options. Signed-off-by: Francesco Cosoleto --- diff --git a/sys-utils/ipcrm.c b/sys-utils/ipcrm.c index f6482abc14..6f741073df 100644 --- a/sys-utils/ipcrm.c +++ b/sys-utils/ipcrm.c @@ -323,52 +323,45 @@ int main(int argc, char **argv) return EXIT_SUCCESS; /* process new syntax to conform with SYSV ipcrm */ - for (id = -1; - (c = getopt_long(argc, argv, "q:m:s:Q:M:S:a::vhV", longopts, NULL)) != -1; - id = -1) { + while((c = getopt_long(argc, argv, "q:m:s:Q:M:S:a::vhV", longopts, NULL)) != -1) { + iskey = 0; switch (c) { case 'M': - iskey = 0; + iskey = 1; id = key_to_id(SHM, optarg); if (id < 0) { ret++; break; } case 'm': - if (id < 0) { - iskey = 1; + if (!iskey) id = strtoll_or_err(optarg, _("failed to parse argument")); - } if (remove_id(SHM, iskey, id)) ret++; break; case 'Q': - iskey = 0; + iskey = 1; id = key_to_id(MSG, optarg); if (id < 0) { ret++; break; } case 'q': - if (id < 0) { - iskey = 1; + if (!iskey) id = strtoll_or_err(optarg, _("failed to parse argument")); - } if (remove_id(MSG, iskey, id)) ret++; break; case 'S': - iskey = 0; + iskey = 1; id = key_to_id(SEM, optarg); if (id < 0) { ret++; break; } case 's': - if (id < 0) { - iskey = 1; + if (!iskey) id = strtoll_or_err(optarg, _("failed to parse argument")); - } if (remove_id(SEM, iskey, id)) ret++; break;