Makefile, debian/{control,inst}: Sort the various lists of things.
[misc] / prlimit.c
index 5c0611f..b7d6df1 100644 (file)
--- a/prlimit.c
+++ b/prlimit.c
@@ -58,10 +58,10 @@ static const struct limittab {
                        msgqueue nice nofile nproc rss rtprio
                        rttime sigpending stack)))
        (save-excursion
-         (goto-char (point-min))
-         (search-forward (concat "***" "BEGIN rlimittab" "***"))
-         (beginning-of-line 2)
-         (delete-region (point)
+        (goto-char (point-min))
+        (search-forward (concat "***" "BEGIN rlimittab" "***"))
+        (beginning-of-line 2)
+        (delete-region (point)
                        (progn
                          (search-forward "***END***")
                          (beginning-of-line)
@@ -175,14 +175,14 @@ static const struct limittab *findlimit(const char *p, size_t n)
     if (strncmp(lt->name, p, n) == 0 && !lt->name[n])
       return (lt);
   }
-  die(EXIT_FAILURE, "unknown resource limit `%.*s'\n", n, p);
+  die(EXIT_FAILURE, "unknown resource limit `%.*s'\n", (int)n, p);
   return (0);
 }
 
 /*----- Help functions ----------------------------------------------------*/
 
 static void usage(FILE *fp)
-  { pquis(fp, "Usage: % -l | "
+  { pquis(fp, "Usage: $ -l | "
          "{hard | soft | both | PID | RSRC[=VALUE]}...\n"); }
 
 static void version(FILE *fp)
@@ -298,9 +298,10 @@ int main(int argc, char *argv[])
 
   for (i = 0; i < npid; i++) {
     for (j = 0; j < nassign; j++) {
-      if (prlimit(pid[i], assign[j].lt->id, 0, &lim)) {
+      lt = assign[j].lt;
+      if (prlimit(pid[i], lt->id, 0, &lim)) {
        moan("failed to read `%s' limit for pid %ld: %s",
-            assign[j].lt->name, (long)pid[i], strerror(errno));
+            lt->name, (long)pid[i], strerror(errno));
        goto err;
       }
       if (!assign[j].which) {
@@ -309,9 +310,9 @@ int main(int argc, char *argv[])
       } else {
        if (assign[j].which & f_soft) lim.rlim_cur = assign[j].val;
        if (assign[j].which & f_hard) lim.rlim_max = assign[j].val;
-       if (prlimit(pid[i], assign[j].lt->id, &lim, 0)) {
+       if (prlimit(pid[i], lt->id, &lim, 0)) {
          moan("failed to set `%s' limit for pid %ld: %s\n",
-              assign[j].lt->name, (long)pid[i], strerror(errno));
+              lt->name, (long)pid[i], strerror(errno));
          goto err;
        }
       }