nixpkgs/pkgs/servers/openpts/ptsc.patch

29 lines
782 B
Diff
Raw Normal View History

2015-08-11 10:13:33 +00:00
diff -urNp openpts-0.2.6-patched/src/ptsc.c openpts-0.2.6-current/src/ptsc.c
--- openpts-0.2.6-patched/src/ptsc.c 2012-08-21 15:57:07.733841433 -0400
+++ openpts-0.2.6-current/src/ptsc.c 2012-08-21 16:13:26.479732504 -0400
@@ -457,7 +457,10 @@ void ptsc_lock(void) {
exit(1);
}
oldgrp = getegid();
- setegid(grp.gr_gid);
+ if(setegid(grp.gr_gid) != 0){
+ LOG(LOG_ERR, "setegid fail");
+ exit(1);
+ }
}
oldmask = umask(0);
@@ -467,7 +470,10 @@ void ptsc_lock(void) {
}
if (grpent) {
chmod(LOCK_DIR, 02775);
- setegid(oldgrp);
+ if(setegid(oldgrp) != 0){
+ LOG(LOG_ERR, "setegid fail");
+ exit(1);
+ }
}
fd = open(LOCK_FILE, O_RDWR | O_CREAT | O_TRUNC, 0660);
if (fd < 0) {