about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2004-02-08 21:05:49 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2004-02-08 21:05:49 +0000
commitd84942a9b46903de5a8738dc701894fa59283524 (patch)
tree6ae05e5842dcdb202881fdf85bb9308f9bae5098
parent97ab9b22d71efe9ce9df1434981c04c611e87077 (diff)
downloadzsh-d84942a9b46903de5a8738dc701894fa59283524.tar.gz
zsh-d84942a9b46903de5a8738dc701894fa59283524.tar.xz
zsh-d84942a9b46903de5a8738dc701894fa59283524.zip
19408: fix argument handling for ulimit -aH
-rw-r--r--ChangeLog4
-rw-r--r--Src/Builtins/rlimits.c16
2 files changed, 17 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index d03d28e49..41aff4261 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2004-02-08  Peter Stephenson  <pws@pwstephenson.fsnet.co.uk>
+
+	* 19408: Src/Builtins/rlimits.c: fix option handling for ulimit -aH.
+
 2004-02-04  Oliver Kiddle  <opk@zsh.org>
 
 	* Mikael Magnusson: 19405: Completion/Unix/Command/_gphoto2:
diff --git a/Src/Builtins/rlimits.c b/Src/Builtins/rlimits.c
index 56f67f06c..db84d8425 100644
--- a/Src/Builtins/rlimits.c
+++ b/Src/Builtins/rlimits.c
@@ -462,7 +462,7 @@ bin_unlimit(char *nam, char **argv, Options ops, int func)
 static int
 bin_ulimit(char *name, char **argv, Options ops, int func)
 {
-    int res, resmask = 0, hard = 0, soft = 0, nres = 0;
+    int res, resmask = 0, hard = 0, soft = 0, nres = 0, all = 0;
     char *options;
 
     do {
@@ -486,11 +486,12 @@ bin_ulimit(char *name, char **argv, Options ops, int func)
 		    soft = 1;
 		    continue;
 		case 'a':
-		    if (*argv || options[1] || resmask) {
-			zwarnnam(name, "no arguments required after -a",
+		    if (resmask) {
+			zwarnnam(name, "no limits allowed with -a",
 				 NULL, 0);
 			return 1;
 		    }
+		    all = 1;
 		    resmask = (1 << RLIM_NLIMITS) - 1;
 		    nres = RLIM_NLIMITS;
 		    continue;
@@ -547,6 +548,11 @@ bin_ulimit(char *name, char **argv, Options ops, int func)
 		    resmask |= 1 << res;
 		    nres++;
 		}
+		if (all && res != -1) {
+		    zwarnnam(name, "no limits allowed with -a",
+			     NULL, 0);
+		    return 1;
+		}
 	    }
 	}
 	if (!*argv || **argv == '-') {
@@ -560,6 +566,10 @@ bin_ulimit(char *name, char **argv, Options ops, int func)
 	    nres++;
 	    continue;
 	}
+	if (all) {
+	    zwarnnam(name, "no arguments allowed after -a", NULL, 0);
+	    return 1;
+	}
 	if (res < 0)
 	    res = RLIMIT_FSIZE;
 	if (strcmp(*argv, "unlimited")) {