This commit is contained in:
Your Name 2023-11-05 20:09:20 +03:00
parent 69fe627457
commit e7e0439e3a

View File

@ -18,23 +18,11 @@ int change(const char *file, const char *mode_arg) {
return 1; return 1;
mode_t mode = mu_parse_mode(mode_arg, old_file.st_mode); mode_t mode = mu_parse_mode(mode_arg, old_file.st_mode);
if (chmod(file, mode) == 0) { if (chmod(file, mode) != 0) {
struct stat new_file; fprintf(stderr, "chmod: unable to chown %s: %s\n", file, strerror(errno));
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);
return 1; return 1;
} }
else
fprintf(stderr, "chmod: unable to chown %s: %s\n", file, strerror(errno));
return 0; return 0;
} }