Skip to content

Commit

Permalink
tty: Avoid EPERM for no-op chown().
Browse files Browse the repository at this point in the history
Signed-off-by: Michał Mirosław <[email protected]>
  • Loading branch information
osctobe authored and avagin committed Jul 22, 2023
1 parent 00d061b commit e90fbd7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion criu/tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "rst-malloc.h"
#include "log.h"
#include "common/list.h"
#include "util.h"
#include "util-pie.h"
#include "proc_parse.h"
#include "file-ids.h"
Expand Down Expand Up @@ -867,7 +868,7 @@ static int restore_tty_params(int fd, struct tty_info *info)
}

if (info->tie->has_uid && info->tie->has_gid) {
if (fchown(fd, info->tie->uid, info->tie->gid)) {
if (cr_fchown(fd, info->tie->uid, info->tie->gid)) {
pr_perror("Can't setup uid %d gid %d on %#x", (int)info->tie->uid, (int)info->tie->gid,
info->tfe->id);
return -1;
Expand Down

0 comments on commit e90fbd7

Please sign in to comment.