diff options
| author | Roy Marples <roy@marples.name> | 2008-07-03 13:30:17 +0000 | 
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2008-07-03 13:30:17 +0000 | 
| commit | 157db50df72c1bcb71689312ea1760668124d9b2 (patch) | |
| tree | 0baf5c568fe86c63af4e051e67f8eece349ae978 /src/rc | |
| parent | a88a177f991527e545e75588013afd16c647e656 (diff) | |
| download | openrc-157db50df72c1bcb71689312ea1760668124d9b2.tar.xz | |
Fix is_older_than a little better, and make is_newer_than correct.
Diffstat (limited to 'src/rc')
| -rw-r--r-- | src/rc/rc-applets.c | 21 | 
1 files changed, 12 insertions, 9 deletions
| diff --git a/src/rc/rc-applets.c b/src/rc/rc-applets.c index 77790e90..6a6216c4 100644 --- a/src/rc/rc-applets.c +++ b/src/rc/rc-applets.c @@ -408,7 +408,6 @@ static int do_shell_var(int argc, char **argv)  void run_applets(int argc, char **argv)  {  	int i = 2; -	bool (*is_than) (const char *, const char *);  	char *p;  	pid_t pid = 0; @@ -439,20 +438,24 @@ void run_applets(int argc, char **argv)  	/* This test is perverted - historically the baselayout function  	 * returns 0 on *failure*, which is plain wrong */ -	if (strcmp(applet, "is_newer_than") == 0 || -	    strcmp(applet, "is_older_than") == 0) -	{ +	if (strcmp(applet, "is_older_than") == 0) {  		if (argc < 3)  			exit (EXIT_FAILURE); -		if (strcmp(applet, "is_newer_than") == 0) -			is_than = &rc_older_than; -		else -			is_than = &rc_newer_than;  		while (i < argc) { -			if (!is_than(argv[1], argv[i++])) +			if (!rc_newer_than(argv[1], argv[i++]))  				exit(EXIT_SUCCESS);  		}  		exit(EXIT_FAILURE); +	}; +	/* This tets is correct as it's not present in baselayout */ +	if (strcmp(applet, "is_newer_than") == 0) { +		if (argc < 3) +			exit (EXIT_FAILURE); +		while (i < argc) { +			if (!rc_newer_than(argv[1], argv[i++])) +				exit(EXIT_FAILURE); +		} +		exit(EXIT_SUCCESS);  	};   	if (applet[0] == 'e' || (applet[0] == 'v' && applet[1] == 'e')) | 
