Adjust permissions depending on action - dedup - deduplicating backup program (HTM) git clone git://bitreich.org/dedup/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/dedup/ (DIR) Log (DIR) Files (DIR) Refs (DIR) Tags (DIR) README (DIR) LICENSE --- (DIR) commit 6ef656f41685cb55c4e982d08cfebc79bd1bc83e (DIR) parent 9ff8b1f2c9ac45e6b1f3184278a1faa1c0362e9f (HTM) Author: sin <sin@2f30.org> Date: Wed, 21 Mar 2018 14:11:31 +0000 Adjust permissions depending on action Diffstat: M dedup.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- (DIR) diff --git a/dedup.c b/dedup.c @@ -537,7 +537,10 @@ main(int argc, char *argv[]) } if (argc == 1) { - fd = open(argv[0], O_RDWR | O_CREAT, 0600); + if (id) + fd = open(argv[0], O_RDWR | O_CREAT, 0600); + else + fd = open(argv[0], O_RDONLY); if (fd == -1) err(1, "open %s", argv[0]); }