Skip to content

Commit

Permalink
check return value of setgid()
Browse files Browse the repository at this point in the history
  • Loading branch information
miquels committed Nov 21, 2016
1 parent 5ab0876 commit 0dc85f5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions dotlockfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,12 @@ int main(int argc, char **argv)
"dotlockfile: %s: permission denied\n", lockfile);
return L_TMPLOCK;
}
} else
setgid(gid);
} else {
if (setgid(gid) < 0) {
perror("dotlockfile: setgid");
return L_ERROR;
}
}

/*
* Now we should be able to chdir() to the lock directory.
Expand Down

0 comments on commit 0dc85f5

Please sign in to comment.