* Preserve the executable bit.

This commit is contained in:
Eelco Dolstra 2003-07-17 11:25:14 +00:00
parent 54664b6fb7
commit 71cc3ceae5

View file

@ -119,6 +119,10 @@ static void dump(const string & path, DumpSink & sink)
if (S_ISREG(st.st_mode)) { if (S_ISREG(st.st_mode)) {
writeString("type", sink); writeString("type", sink);
writeString("regular", sink); writeString("regular", sink);
if (st.st_mode & S_IXUSR) {
writeString("executable", sink);
writeString("", sink);
}
dumpContents(path, st.st_size, sink); dumpContents(path, st.st_size, sink);
} }
@ -295,6 +299,15 @@ static void restore(const string & path, RestoreSource & source)
restoreContents(fd, path, source); restoreContents(fd, path, source);
} }
else if (s == "executable" && type == tpRegular) {
readString(source);
struct stat st;
if (fstat(fd, &st) == -1)
throw SysError("fstat");
if (fchmod(fd, st.st_mode | (S_IXUSR | S_IXGRP | S_IXOTH)) == -1)
throw SysError("fchmod");
}
else if (s == "entry" && type == tpDirectory) { else if (s == "entry" && type == tpDirectory) {
restoreEntry(path, source); restoreEntry(path, source);
} }