Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37046092
en ru br
Репозитории ALT
S:6.6.4-alt1
5.1: 6.4-alt0.5
4.1: 6.4-alt0.5
4.0: 6.4-alt0.4
3.0: 6.3.5-alt5
www.altlinux.org/Changes

Другие репозитории
Upstream:6.3.2

Группа :: Мониторинг
Пакет: acct

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: acct-6.3.5-owl-devpts.patch
Скачать


diff -urp acct-6.3.5.orig/dev_hash.c acct-6.3.5/dev_hash.c
--- acct-6.3.5.orig/dev_hash.c	Thu Apr 18 23:18:15 1996
+++ acct-6.3.5/dev_hash.c	Mon May  5 02:31:13 2003
@@ -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;
+}
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin