summary refs log tree commit diff
path: root/Src/Builtins/rlimits.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Builtins/rlimits.c')
-rw-r--r--Src/Builtins/rlimits.c60
1 files changed, 28 insertions, 32 deletions
diff --git a/Src/Builtins/rlimits.c b/Src/Builtins/rlimits.c
index 922a182a2..e7df978a9 100644
--- a/Src/Builtins/rlimits.c
+++ b/Src/Builtins/rlimits.c
@@ -161,7 +161,7 @@ showlimits(char *nam, int hard, int lim)
 	struct rlimit vals;
 	if (getrlimit(lim, &vals) < 0)
 	{
-	    zwarnnam(nam, "can't read limit: %e", NULL, errno);
+	    zwarnnam(nam, "can't read limit: %e", errno);
 	    return 1;
 	}
 	showlimitvalue(lim, hard ? vals.rlim_max : vals.rlim_cur);
@@ -199,7 +199,7 @@ printulimit(char *nam, int lim, int hard, int head)
 
 	if (getrlimit(lim, &vals) < 0)
 	{
-	    zwarnnam(nam, "can't read limit: %e", NULL, errno);
+	    zwarnnam(nam, "can't read limit: %e", errno);
 	    return 1;
 	}
 	limit = (hard) ? vals.rlim_max : vals.rlim_cur;
@@ -378,13 +378,13 @@ do_limit(char *nam, int lim, rlim_t val, int hard, int soft, int set)
 	if (getrlimit(lim, &vals) < 0)
 	{
 	    /* best guess about error */
-	    zwarnnam(nam, "can't read limit: %e", NULL, errno);
+	    zwarnnam(nam, "can't read limit: %e", errno);
 	    return 1;
 	}
 	if (hard)
 	{
 	    if (val > vals.rlim_max && geteuid()) {
-		zwarnnam(nam, "can't raise hard limits", NULL, 0);
+		zwarnnam(nam, "can't raise hard limits");
 		return 1;
 	    }
 	    vals.rlim_max = val;
@@ -397,7 +397,7 @@ do_limit(char *nam, int lim, rlim_t val, int hard, int soft, int set)
 	}
 	if (soft || !hard) {
 	    if (val > vals.rlim_max) {
-		zwarnnam(nam, "limit exceeds hard limit", NULL, 0);
+		zwarnnam(nam, "limit exceeds hard limit");
 		return 1;
 	    }
 	    else
@@ -407,12 +407,12 @@ do_limit(char *nam, int lim, rlim_t val, int hard, int soft, int set)
 	{
 	    zwarnnam(nam,
 		     "warning: unrecognised limit %d, use -s to set",
-		     NULL, lim);
+		     lim);
 	    return 1;
 	}
 	else if (setrlimit(lim, &vals) < 0)
 	{
-	    zwarnnam(nam, "setrlimit failed: %e", NULL, errno);
+	    zwarnnam(nam, "setrlimit failed: %e", errno);
 	    return 1;
 	}
     } else {
@@ -421,7 +421,7 @@ do_limit(char *nam, int lim, rlim_t val, int hard, int soft, int set)
 	if (hard) {
 	    /* can only raise hard limits if running as root */
 	    if (val > current_limits[lim].rlim_max && geteuid()) {
-		zwarnnam(nam, "can't raise hard limits", NULL, 0);
+		zwarnnam(nam, "can't raise hard limits");
 		return 1;
 	    } else {
 		limits[lim].rlim_max = val;
@@ -436,13 +436,13 @@ do_limit(char *nam, int lim, rlim_t val, int hard, int soft, int set)
 		{
 		    /* ulimit does this */
 		    if (val > current_limits[lim].rlim_max && geteuid()) {
-			zwarnnam(nam, "value exceeds hard limit", NULL, 0);
+			zwarnnam(nam, "value exceeds hard limit");
 			return 1;
 		    }
 		    limits[lim].rlim_max = limits[lim].rlim_cur = val;
 		} else {
 		    /* but limit does this */
-		    zwarnnam(nam, "limit exceeds hard limit", NULL, 0);
+		    zwarnnam(nam, "limit exceeds hard limit");
 		    return 1;
 		}
 	    } else
@@ -493,7 +493,7 @@ bin_limit(char *nam, char **argv, Options ops, UNUSED(int func))
 	if (lim < 0) {
 	    zwarnnam(nam,
 		     (lim == -2) ? "ambiguous resource specification: %s"
-		     : "no such resource: %s", s, 0);
+		     : "no such resource: %s", s);
 	    return 1;
 	}
 	/* without value for limit, display the current limit */
@@ -505,7 +505,7 @@ bin_limit(char *nam, char **argv, Options ops, UNUSED(int func))
 	    if (*s)
 	    {
 		/* unknown limit, no idea how to scale */
-		zwarnnam(nam, "unknown scaling factor: %s", s, 0);
+		zwarnnam(nam, "unknown scaling factor: %s", s);
 		return 1;
 	    }
 	}
@@ -523,7 +523,7 @@ bin_limit(char *nam, char **argv, Options ops, UNUSED(int func))
 		else if (*s == ':')
 		    val = val * 60 + zstrtorlimt(s + 1, &s, 10);
 		else {
-		    zwarnnam(nam, "unknown scaling factor: %s", s, 0);
+		    zwarnnam(nam, "unknown scaling factor: %s", s);
 		    return 1;
 		}
 	    }
@@ -533,7 +533,7 @@ bin_limit(char *nam, char **argv, Options ops, UNUSED(int func))
 	    char *t = s;
 	    val = zstrtorlimt(t, &s, 10);
 	    if (s == t) {
-		zwarnnam(nam, "limit must be a number", NULL, 0);
+		zwarnnam(nam, "limit must be a number");
 		return 1;
 	    }
 	} else {
@@ -546,7 +546,7 @@ bin_limit(char *nam, char **argv, Options ops, UNUSED(int func))
 	    } else if ((*s == 'M' || *s == 'm') && !s[1])
 		val *= 1024L * 1024;
 	    else {
-		zwarnnam(nam, "unknown scaling factor: %s", s, 0);
+		zwarnnam(nam, "unknown scaling factor: %s", s);
 		return 1;
 	    }
 	}
@@ -565,12 +565,12 @@ do_unlimit(char *nam, int lim, int hard, int soft, int set, int euid)
 	struct rlimit vals;
 	if (getrlimit(lim, &vals) < 0)
 	{
-	    zwarnnam(nam, "can't read limit: %e", NULL, errno);
+	    zwarnnam(nam, "can't read limit: %e", errno);
 	    return 1;
 	}
 	if (hard) {
 	    if (euid && vals.rlim_max != RLIM_INFINITY) {
-		zwarnnam(nam, "can't remove hard limits", NULL, 0);
+		zwarnnam(nam, "can't remove hard limits");
 		return 1;
 	    } else
 		vals.rlim_max = RLIM_INFINITY;
@@ -579,17 +579,16 @@ do_unlimit(char *nam, int lim, int hard, int soft, int set, int euid)
 	    vals.rlim_cur = vals.rlim_max;
 	if (!set) {
 	    zwarnnam(nam,
-		     "warning: unrecognised limit %d, use -s to set",
-		     NULL, lim);
+		     "warning: unrecognised limit %d, use -s to set", lim);
 	    return 1;
 	} else if (setrlimit(lim, &vals) < 0) {
-	    zwarnnam(nam, "setrlimit failed: %e", NULL, errno);
+	    zwarnnam(nam, "setrlimit failed: %e", errno);
 	    return 1;
 	}
     } else {
 	if (hard) {
 	    if (euid && current_limits[lim].rlim_max != RLIM_INFINITY) {
-		zwarnnam(nam, "can't remove hard limits", NULL, 0);
+		zwarnnam(nam, "can't remove hard limits");
 		return 1;
 	    } else
 		limits[lim].rlim_max = RLIM_INFINITY;
@@ -628,7 +627,7 @@ bin_unlimit(char *nam, char **argv, Options ops, UNUSED(int func))
 	if (OPT_ISSET(ops,'s'))
 	    ret += setlimits(nam);
 	if (ret)
-	    zwarnnam(nam, "can't remove hard limits", NULL, 0);
+	    zwarnnam(nam, "can't remove hard limits");
     } else {
 	for (; *argv; argv++) {
 	    /* Search for the appropriate resource name.  When a name     *
@@ -651,7 +650,7 @@ bin_unlimit(char *nam, char **argv, Options ops, UNUSED(int func))
 	    if (lim < 0) {
 		zwarnnam(nam,
 			 (lim == -2) ? "ambiguous resource specification: %s"
-			 : "no such resource: %s", *argv, 0);
+			 : "no such resource: %s", *argv);
 		return 1;
 	    }
 	    else if (do_unlimit(nam, lim, hard, !hard, OPT_ISSET(ops, 's'),
@@ -674,7 +673,7 @@ bin_ulimit(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
     do {
 	options = *argv;
 	if (options && *options == '-' && !options[1]) {
-	    zwarnnam(name, "missing option letter", NULL, 0);
+	    zwarnnam(name, "missing option letter");
 	    return 1;
 	}
 	res = -1;
@@ -697,8 +696,7 @@ bin_ulimit(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
 		    } else if (*argv) {
 			res = (int)zstrtol(*argv++, NULL, 10);
 		    } else {
-			zwarnnam(name, "number required after -N",
-				 NULL, 0);
+			zwarnnam(name, "number required after -N");
 			return 1;
 		    }
 		    /*
@@ -709,8 +707,7 @@ bin_ulimit(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
 		    break;
 		case 'a':
 		    if (resmask) {
-			zwarnnam(name, "no limits allowed with -a",
-				 NULL, 0);
+			zwarnnam(name, "no limits allowed with -a");
 			return 1;
 		    }
 		    all = 1;
@@ -778,7 +775,7 @@ bin_ulimit(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
 # endif
 		default:
 		    /* unrecognised limit */
-		    zwarnnam(name, "bad option: -%c", NULL, *options);
+		    zwarnnam(name, "bad option: -%c", *options);
 		    return 1;
 		}
 		if (options[1]) {
@@ -786,8 +783,7 @@ bin_ulimit(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
 		    nres++;
 		}
 		if (all && res != -1) {
-		    zwarnnam(name, "no limits allowed with -a",
-			     NULL, 0);
+		    zwarnnam(name, "no limits allowed with -a");
 		    return 1;
 		}
 	    }
@@ -804,7 +800,7 @@ bin_ulimit(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
 	    continue;
 	}
 	if (all) {
-	    zwarnnam(name, "no arguments allowed after -a", NULL, 0);
+	    zwarnnam(name, "no arguments allowed after -a");
 	    return 1;
 	}
 	if (res < 0)