Group :: Monitoring
RPM: acct
Main Changelog Spec Patches Sources Download Gear Bugs and FR Repocop
Patch: acct-6.4pre1-owl-devpts.patch
Download
Download
diff -puNr acct-6.4-pre1.orig/dev_hash.c acct-6.4-pre1/dev_hash.c
--- acct-6.4-pre1.orig/dev_hash.c 2006-01-07 21:56:46 +0000
+++ acct-6.4-pre1/dev_hash.c 2006-05-19 09:49:12 +0000
@@ -52,6 +52,10 @@ char *alloca ();
# endif
#endif
+#if defined(__linux__) && !defined(UNIX98_PTY_SLAVE_MAJOR)
+#include <linux/major.h>
+#endif
+
/* globals */
@@ -87,7 +91,8 @@ setup_devices (char *dirname)
+ 1) * sizeof (char));
sprintf (fullname, "%s/%s", dirname, dp->d_name);
- stat (fullname, &sp);
+ if (lstat (fullname, &sp))
+ continue;
if ((sp.st_mode & S_IFMT) != S_IFCHR) /* skip if not a tty */
continue;
@@ -122,6 +127,7 @@ setup_devices (char *dirname)
char *
devname (long dev_num)
{
+ static char dev_name[16];
struct hashtab_elem *he;
/* special case */
@@ -135,6 +141,11 @@ devname (long dev_num)
setup_devices ("/dev"); /* most certainly */
setup_devices ("/dev/pty"); /* perhaps */
setup_devices ("/dev/ptym"); /* perhaps */
+#ifndef UNIX98_PTY_SLAVE_MAJOR
+ /* This will catch only currently active devices, so we prefer
+ * to calculate the device name manually if we have the major. */
+ setup_devices ("/dev/pts"); /* perhaps */
+#endif
}
he = hashtab_find (dev_table, (void *) &dev_num, sizeof (dev_num));
@@ -146,7 +157,17 @@ devname (long dev_num)
}
/* didn't find it */
-
- return "??";
-}
+ if (dev_num == 0)
+ return "(none)";
+#ifdef UNIX98_PTY_SLAVE_MAJOR
+ else if ((dev_num >> 8) == UNIX98_PTY_SLAVE_MAJOR)
+ {
+ snprintf(dev_name, sizeof(dev_name), "pts/%ld", dev_num & 0xff);
+ return dev_name;
+ }
+#endif
+
+ snprintf(dev_name, sizeof(dev_name), "%ld,%ld", dev_num >> 8, dev_num & 0xff);
+ return dev_name;
+}