Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
partially functional; file modes and owners are not preserved
- Loading branch information
1 parent
860b1dc
commit 6b8e030
Showing
5 changed files
with
41 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* -text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
fast-archiver | ||
fast-archiver.exe | ||
*.swp | ||
*.swo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package falib | ||
|
||
import ( | ||
"os" | ||
"syscall" | ||
) | ||
|
||
func (a *Archiver) getModeOwnership(file *os.File) (int, int, os.FileMode) { | ||
var uid int = 0 | ||
var gid int = 0 | ||
var mode os.FileMode = 0 | ||
fi, err := file.Stat() | ||
if err != nil { | ||
a.Logger.Warning("file stat error; uid/gid/mode will be incorrect:", err.Error()) | ||
} else { | ||
mode = fi.Mode() | ||
stat_t := fi.Sys().(*syscall.Stat_t) | ||
if stat_t != nil { | ||
uid = int(stat_t.Uid) | ||
gid = int(stat_t.Gid) | ||
} else { | ||
a.Logger.Warning("unable to find file uid/gid") | ||
} | ||
} | ||
return uid, gid, mode | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package falib | ||
|
||
import "os" | ||
|
||
func (a *Archiver) getModeOwnership(file *os.File) (uid int, gid int, mode os.FileMode) { | ||
fi, err := file.Stat() | ||
if err != nil { | ||
a.Logger.Warning("file stat error; uid/gid/mode will be incorrect:", err.Error()) | ||
} else { | ||
mode = fi.Mode() | ||
} | ||
return | ||
} |