OSDN Git Service

Nickolai Zeldovich writes:
authorMike Frysinger <vapier@gentoo.org>
Wed, 2 May 2007 08:05:09 +0000 (08:05 -0000)
committerMike Frysinger <vapier@gentoo.org>
Wed, 2 May 2007 08:05:09 +0000 (08:05 -0000)
Currently, tcgetpgrp() in uClibc uses an int to store a PID (fetched
via ioctl TIOCGPGRP).  This causes problems on platforms where pid_t
is defined to be larger (e.g., uint64_t).  Other functions in termios,
such as tcgetsid() and tcsetpgrp(), already pass a pid_t to ioctl(),
so the following patch does the same in tcgetpgrp() as well.

libc/termios/tcgetpgrp.c

index 2416707..1ad3171 100644 (file)
@@ -27,10 +27,10 @@ libc_hidden_proto(ioctl)
 /* Return the foreground process group ID of FD.  */
 pid_t tcgetpgrp (int fd)
 {
-  int pgrp;
+  pid_t pgrp;
 
   if (ioctl (fd, TIOCGPGRP, &pgrp) < 0)
-    return (pid_t) -1;
-  return (pid_t) pgrp;
+    return -1;
+  return pgrp;
 }
 libc_hidden_def (tcgetpgrp)