free(label);
}
- // change owner and groups for symbolic link.
+ // change owner, groups and mode for symbolic link.
if (!lstat(fromPath.c_str(), &info)) {
if (lchown(toPath.c_str(), info.st_uid, info.st_gid) == -1)
_SERR("Failed to change owner and group name");
+ if (lchmod(toPath.c_str(), info.st_mode) == -1)
+ _SERR("Failed to change mode");
}
} else {
// change smack label
free(label);
}
- // change owner and groups for generated ni file.
+ // change owner, groups and mode for generated ni file.
if (!stat(fromPath.c_str(), &info)) {
if (chown(toPath.c_str(), info.st_uid, info.st_gid) == -1)
_SERR("Failed to change owner and group name");
+ if (chmod(toPath.c_str(), info.st_mode) == -1)
+ _SERR("Failed to change mode");
}
}
}