Fix a broken guard around utime()
Because of an outdated check for a timestamp of 0, we were calling utime() even when it wasn't necessary.
This commit is contained in:
		
							parent
							
								
									58ac7a17a4
								
							
						
					
					
						commit
						5e57047d87
					
				
					 1 changed files with 5 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -394,6 +394,9 @@ void LocalStore::openDB(bool create)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
const time_t mtimeStore = 1; /* 1 second into the epoch */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void canonicalisePathMetaData(const Path & path, bool recurse)
 | 
			
		||||
{
 | 
			
		||||
    checkInterrupt();
 | 
			
		||||
| 
						 | 
				
			
			@ -433,10 +436,10 @@ void canonicalisePathMetaData(const Path & path, bool recurse)
 | 
			
		|||
                throw SysError(format("changing mode of `%1%' to %2$o") % path % mode);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (st.st_mtime != 0) {
 | 
			
		||||
        if (st.st_mtime != mtimeStore) {
 | 
			
		||||
            struct utimbuf utimbuf;
 | 
			
		||||
            utimbuf.actime = st.st_atime;
 | 
			
		||||
            utimbuf.modtime = 1; /* 1 second into the epoch */
 | 
			
		||||
            utimbuf.modtime = mtimeStore;
 | 
			
		||||
            if (utime(path.c_str(), &utimbuf) == -1) 
 | 
			
		||||
                throw SysError(format("changing modification time of `%1%'") % path);
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue