commit 6ef656f41685cb55c4e982d08cfebc79bd1bc83e
parent 9ff8b1f2c9ac45e6b1f3184278a1faa1c0362e9f
Author: sin <sin@2f30.org>
Date: Wed, 21 Mar 2018 14:11:31 +0000
Adjust permissions depending on action
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
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]);
}