mirror of
https://github.com/Stichting-MINIX-Research-Foundation/pkgsrc-ng.git
synced 2025-08-05 10:48:03 -04:00
32 lines
960 B
Bash
32 lines
960 B
Bash
$NetBSD: patch-tty.sh,v 1.3 2016/06/20 16:04:44 ryoon Exp $
|
|
|
|
Change condition for using TIOCSCTTY.
|
|
|
|
NetBSD on the netbsd-5 branch insists on a non-NULL second argument
|
|
to the realpath() function. Make it so.
|
|
|
|
--- tty.sh.orig 2016-06-19 19:41:03.000000000 +0000
|
|
+++ tty.sh
|
|
@@ -813,7 +813,8 @@ int fd;
|
|
/*
|
|
* Under BSD we have to set the controlling terminal again explicitly.
|
|
*/
|
|
-# if (defined(__FreeBSD_kernel__) || defined(__DragonFly__) || defined(__GNU__)) && defined(TIOCSCTTY)
|
|
+# if (defined(__FreeBSD_kernel__) || defined(__DragonFly__) \
|
|
+ || defined(__GNU__) || (BSD >= 199103)) && defined(TIOCSCTTY)
|
|
ioctl(fd, TIOCSCTTY, (char *)0);
|
|
# endif
|
|
|
|
@@ -1510,8 +1511,10 @@ char *tty;
|
|
char realbuf[PATH_MAX];
|
|
const char *real;
|
|
int rc;
|
|
+ char *ttynamebuf;
|
|
|
|
- real = realpath(tty, realbuf);
|
|
+ ttynamebuf = malloc(MAXPATHLEN);
|
|
+ real = realpath(tty, ttynamebuf);
|
|
if (!real)
|
|
return -1;
|
|
realbuf[sizeof(realbuf)-1]='\0';
|