diff options
| author | Roy Marples <roy@marples.name> | 2008-01-15 09:24:50 +0000 | 
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2008-01-15 09:24:50 +0000 | 
| commit | 3e0f49b846924a54df9115c038cf0a559a567db2 (patch) | |
| tree | 63fb567cc51095400c596f3f323c42f4ee290598 /src/librc | |
| parent | b29c4aa9267592472cc591be88de6a854d24dd66 (diff) | |
| download | openrc-3e0f49b846924a54df9115c038cf0a559a567db2.tar.xz | |
rc_newer_than no longer tests if souce has data, making it a more logical function. As such, we add the existss function to check for existance and size when checking to see if the deptree needs an update.
Diffstat (limited to 'src/librc')
| -rw-r--r-- | src/librc/librc-depend.c | 11 | 
1 files changed, 8 insertions, 3 deletions
| diff --git a/src/librc/librc-depend.c b/src/librc/librc-depend.c index f52c6de2..4ccd7ee2 100644 --- a/src/librc/librc-depend.c +++ b/src/librc/librc-depend.c @@ -606,7 +606,8 @@ bool rc_newer_than (const char *source, const char *target)  	char *path;  	int serrno = errno; -	if (stat (source, &buf) != 0 || buf.st_size == 0) +	/* We have to exist */ +	if (stat (source, &buf) != 0)  		return (false);  	mtime = buf.st_mtime; @@ -618,11 +619,13 @@ bool rc_newer_than (const char *source, const char *target)  	if (mtime < buf.st_mtime)  		return (false); +	/* If not a dir then reset errno */  	if (! (dp = opendir (target))) {  		errno = serrno;  		return (true);  	} +	/* Check if we're newer than all the entries in the dir */  	while ((d = readdir (dp))) {  		if (d->d_name[0] == '.')  			continue; @@ -682,8 +685,10 @@ bool rc_deptree_update_needed (void)  		if (mkdir (depdirs[i], 0755) != 0 && errno != EEXIST)  			fprintf (stderr, "mkdir `%s': %s\n", depdirs[i], strerror (errno)); -	/* Quick test to see if anything we use has changed */ -	if (! rc_newer_than (RC_DEPTREE, RC_INITDIR) || +	/* Quick test to see if anything we use has changed and we have +	 * data in our deptree */ +	if (! existss (RC_DEPTREE) || +	    ! rc_newer_than (RC_DEPTREE, RC_INITDIR) ||  	    ! rc_newer_than (RC_DEPTREE, RC_CONFDIR) ||  	    ! rc_newer_than (RC_DEPTREE, RC_INITDIR_LOCAL) ||  	    ! rc_newer_than (RC_DEPTREE, RC_CONFDIR_LOCAL) || | 
