diff options
-rw-r--r-- | src/archive.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/archive.cc b/src/archive.cc index c9b78824e74b..73fc75fa27d4 100644 --- a/src/archive.cc +++ b/src/archive.cc @@ -119,6 +119,10 @@ static void dump(const string & path, DumpSink & sink) if (S_ISREG(st.st_mode)) { writeString("type", sink); writeString("regular", sink); + if (st.st_mode & S_IXUSR) { + writeString("executable", sink); + writeString("", sink); + } dumpContents(path, st.st_size, sink); } @@ -295,6 +299,15 @@ static void restore(const string & path, RestoreSource & 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) { restoreEntry(path, source); } |