]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
prlimit: fix error message
authorKarel Zak <kzak@redhat.com>
Wed, 16 Nov 2011 09:54:07 +0000 (10:54 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 16 Nov 2011 09:54:07 +0000 (10:54 +0100)
 - differentiate between set and get operations
 - add limit name to the error message
 - remove PID from the message (whole util works always with only one
   PID, so this info is superfluous)

Reported-by: Bernhard Voelker <mail@bernhard-voelker.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/prlimit.c

index fed4f382c233a563213d25cac19252daebdccc0a..02e520a3bcbd88df82863e18ff58159a2ed8eee9 100644 (file)
@@ -294,7 +294,6 @@ done:
        return 0;
 }
 
-
 static void do_prlimit(struct prlimit lims[], size_t n, int tt_flags)
 {
        size_t i, nshows = 0;
@@ -321,7 +320,10 @@ static void do_prlimit(struct prlimit lims[], size_t n, int tt_flags)
                }
 
                if (prlimit(pid, lims[i].desc->resource, new, &lims[i].rlim) == -1)
-                       err(EXIT_FAILURE, _("failed to get resource limits for PID %d"), pid);
+                       err(EXIT_FAILURE, lims[i].modify ?
+                               _("failed to set the %s resource limit") :
+                               _("failed to get the %s resource limit"),
+                               lims[i].desc->name);
        }
 
        if (nshows)