From e7e0439e3acee086d64bb4c830295f200836d04c Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 5 Nov 2023 20:09:20 +0300 Subject: [PATCH] chmod --- coreutils/chmod.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/coreutils/chmod.c b/coreutils/chmod.c index 7492f4d..d45f3da 100644 --- a/coreutils/chmod.c +++ b/coreutils/chmod.c @@ -18,23 +18,11 @@ int change(const char *file, const char *mode_arg) { return 1; mode_t mode = mu_parse_mode(mode_arg, old_file.st_mode); - if (chmod(file, mode) == 0) { - struct stat new_file; - if (get_stat("chmod", file, &new_file)) - return 1; - - if (old_file.st_mode != new_file.st_mode) - return 0; - - if (!s_flag) - fprintf(stderr, "chmod: %s unchanged\n", file); - + if (chmod(file, mode) != 0) { + fprintf(stderr, "chmod: unable to chown %s: %s\n", file, strerror(errno)); return 1; } - else - fprintf(stderr, "chmod: unable to chown %s: %s\n", file, strerror(errno)); - return 0; }