Skip to content

Commit

Permalink
tty: Avoid EPERM for no-op chown().
Browse files Browse the repository at this point in the history
Change-Id: I773afca3814bfcf33a5621394e21aaf0a18f655b
Signed-off-by: Michał Mirosław <emmir@google.com>
  • Loading branch information
osctobe committed Jun 21, 2023
1 parent 3772781 commit a447c2c
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 (fchown_nopriv(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 a447c2c

Please sign in to comment.