* utime() follows symlinks, so don't change the mtime if the file is a
symlink.
This commit is contained in:
		
							parent
							
								
									eee6fe478e
								
							
						
					
					
						commit
						13f77276d1
					
				
					 1 changed files with 8 additions and 7 deletions
				
			
		| 
						 | 
					@ -334,14 +334,15 @@ void canonicalisePathMetaData(const Path & path)
 | 
				
			||||||
                throw SysError(format("changing owner/group of `%1%' to %2%/%3%")
 | 
					                throw SysError(format("changing owner/group of `%1%' to %2%/%3%")
 | 
				
			||||||
                    % path % getuid() % getgid());
 | 
					                    % path % getuid() % getgid());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (st.st_mtime != 0) {
 | 
					        if (st.st_mtime != 0) {
 | 
				
			||||||
        struct utimbuf utimbuf;
 | 
					            struct utimbuf utimbuf;
 | 
				
			||||||
        utimbuf.actime = st.st_atime;
 | 
					            utimbuf.actime = st.st_atime;
 | 
				
			||||||
        utimbuf.modtime = 0;
 | 
					            utimbuf.modtime = 0;
 | 
				
			||||||
        if (utime(path.c_str(), &utimbuf) == -1) 
 | 
					            if (utime(path.c_str(), &utimbuf) == -1) 
 | 
				
			||||||
            throw SysError(format("changing modification time of `%1%'") % path);
 | 
					                throw SysError(format("changing modification time of `%1%'") % path);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (S_ISDIR(st.st_mode)) {
 | 
					    if (S_ISDIR(st.st_mode)) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue