728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
|
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
|
+
+
+
|
fossil_print("Set mtime of \"%s\" to %s (%lld)\n", zFile, zDate, iMTime);
}
/*
** Change access permissions on a file.
*/
void file_set_mode(const char *zFN, int fd, const char *zMode, int bNoErr){
#if !defined(_WIN32)
mode_t m;
char *zEnd = 0;
m = strtol(zMode, &zEnd, 0);
if( (zEnd[0] || fchmod(fd, m)) && !bNoErr ){
fossil_fatal("cannot change permissions on %s to \"%s\"",
zFN, zMode);
}
#endif
}
/* Change the owner of a file to zOwner. zOwner can be of the form
** USER:GROUP.
*/
void file_set_owner(const char *zFN, int fd, const char *zOwner){
#if !defined(_WIN32)
const char *zGrp;
const char *zUsr = zOwner;
struct passwd *pw;
struct group *grp;
uid_t uid = -1;
gid_t gid = -1;
zGrp = strchr(zUsr, ':');
|
771
772
773
774
775
776
777
778
779
780
781
782
783
784
|
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
|
+
|
}
if( chown(zFN, uid, gid) ){
fossil_fatal("cannot change ownership of %s to %s",zFN, zOwner);
}
if( zOwner!=zUsr ){
fossil_free((char*)zUsr);
}
#endif
}
/*
** Delete a file.
**
** If zFilename is a symbolic link, then it is the link itself that is
|