forked from lix-project/lix
* Preserve the executable bit.
This commit is contained in:
parent
54664b6fb7
commit
71cc3ceae5
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue