summaryrefslogtreecommitdiff
path: root/open.c
diff options
context:
space:
mode:
authortjg <tjg>2000-05-25 14:31:27 +0000
committerToby Goodwin <toby@paccrat.org>2015-05-16 21:23:18 +0100
commitba2b5321c58c1a7420c7d9d31c1226584537bcaa (patch)
tree4c56ff936104b936b9b8b057d5d45cb260e5ecf8 /open.c
parent8293905f58f0cea00a03ca9bec122de84887a2be (diff)
Portability: need special runes for read() returning EIO under job
control systems.
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;
+}