summaryrefslogtreecommitdiff
path: root/open.c
diff options
context:
space:
mode:
Diffstat (limited to 'open.c')
-rw-r--r--open.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/open.c b/open.c
index bac9f2c..60555b0 100644
--- a/open.c
+++ b/open.c
@@ -43,3 +43,21 @@ extern bool makeblocking(int fd) {
}
return TRUE;
}
+
+/* make a file descriptor the same pgrp as us. Returns TRUE if
+it changes anything. */
+
+extern bool makesamepgrp(int fd) {
+ pid_t grp;
+
+ grp = getpgrp();
+
+ if (tcgetpgrp(fd) == grp)
+ return FALSE;
+
+ if (tcsetpgrp(fd, grp) < 0) {
+ uerror("tcsetgrp");
+ return FALSE;
+ }
+ return TRUE;
+}