--- jhlp.c.old	Sun Jul  5 03:14:51 1998
+++ jhlp.c	Sun Jul  5 03:16:39 1998
@@ -1132,6 +1132,7 @@
 /** »Ò¥×¥í¥»¥¹¤òµ¯¤³¤¹¡£*/
 
 int ttypfd;
+char *ttypname;
 
 static void
 exec_cmd(argv)
@@ -1174,7 +1175,7 @@
 	setpgrp(0, pid);
 #endif /* BSD42 */
 
-	if (setutmp(ttypfd) == ERROR) {
+	if (setutmp(ttypname) == ERROR) {
 	    puts("Can't set utmp.");
 	} 
 
@@ -1410,6 +1411,9 @@
     if ((ttypfd = open(nmbuf, O_RDWR, 0)) == ERROR) {
 	err("Can't open ttyp.");
     }
+    if ((ttypname = ttyname(ttypfd)) == NULL) {
+    	err("Can't get ttyname.");
+    }
 #ifndef linux
     chown(nmbuf, getuid(), getgid());
     chmod(nmbuf, 0622);
@@ -1634,7 +1638,7 @@
 	perror(prog);
     }
 
-    if (resetutmp(ttypfd) == ERROR) {
+    if (resetutmp(ttypname) == ERROR) {
 	printf("Can't reset utmp.\n");
     }
 #ifdef TIOCSSIZE
--- setutmp.c.old	Thu Mar 20 16:32:52 1997
+++ setutmp.c	Sun Jul  5 03:46:55 1998
@@ -105,22 +105,21 @@
     return 0;
 }
 
-public int setutmp(ttyFd)
-int ttyFd;
+public int setutmp(p)
+char *p;
 {
     int utmpFd;
     struct utmp ut;
-    char *p;
     int i;
 
     if (suf <= 0) return -1;
     bzero(&ut, sizeof ut);
-    if ((p = ttyname(ttyFd)) == NULL) return -1;
+    if (p == NULL) return -1;
     strncpy(ut.ut_line, rindex(p, '/') + 1, 8);
     strncpy(ut.ut_name, getpwuid(getuid())->pw_name, 8);
     ut.ut_time = time(0);
     strncpy(ut.ut_host, savttynm, 8);
-    if (!(i = ttyfdslot(ttyFd))) return -1;
+    if (!(i = ttyfdslot(p))) return -1;
     if ((utmpFd = open(_PATH_UTMP, O_RDWR, 0)) < 0) return -1;
     lseek(utmpFd, savslotnum * (sizeof nullut), 0);
     write(utmpFd, &nullut, sizeof nullut);
@@ -132,15 +131,14 @@
 #endif /* BSD42 */
 
 #ifdef SYSVR2
-public int setutmp(ttyFd)
-int ttyFd;
+public int setutmp(p)
+char *p;
 {
     struct utmp ut;
-    char *p;
     struct passwd *getpwuid();
 
     memset(&ut, 0, sizeof ut);
-    if ((p = ttyname(ttyFd)) == NULL) return -1;
+    if (p == NULL) return -1;
     strncpy(ut.ut_line, strrchr(p, '/') + 1, 12);
     strncpy(ut.ut_user, getpwuid(getuid())->pw_name, 8);
     ut.ut_time = time(0);
@@ -157,19 +155,18 @@
 #endif /* SYSVR2 */
 
 #ifdef BSD42
-public int resetutmp(ttyFd)
-int ttyFd;
+public int resetutmp(p)
+char *p;
 {
     int utmpFd;
     struct utmp ut;
-    char *p;
     int i;
 
     bzero(&ut, sizeof ut);
-    if ((p = ttyname(ttyFd)) == NULL) return -1;
+    if (p == NULL) return -1;
     strncpy(ut.ut_line, rindex(p, '/') + 1, 8);
     ut.ut_time = time(0);
-    if (!(i = ttyfdslot(ttyFd))) return -1;
+    if (!(i = ttyfdslot(p))) return -1;
     if ((utmpFd = open(_PATH_UTMP, O_RDWR, 0)) < 0) return -1;
     lseek(utmpFd, savslotnum * (sizeof saveut), 0);
     write(utmpFd, &saveut, sizeof saveut);
@@ -181,15 +178,14 @@
 #endif /* BSD42 */
 
 #ifdef SYSVR2
-public int resetutmp(ttyFd)
-int ttyFd;
+public int resetutmp(p)
+char *p;
 {
     struct utmp ut;
-    char *p;
     struct passwd *getpwuid();
 
     memset(&ut, 0, sizeof ut);
-    if ((p = ttyname(ttyFd)) == NULL) return -1;
+    if (p == NULL) return -1;
     strncpy(ut.ut_line, strrchr(p, '/') + 1, 12);
     strncpy(ut.ut_user, getpwuid(getuid())->pw_name, 8);
     ut.ut_time = time(0);
--- ttyfdslot.c.old	Thu Mar 20 16:31:35 1997
+++ ttyfdslot.c	Sun Jul  5 02:45:47 1998
@@ -61,8 +61,8 @@
 char *ttyname();
 char *rindex();
 
-int ttyfdslot(fd)
-int fd;
+int ttyfdslot(p)
+char *p;
 {
     char eachslot[SLOTSIZ];
     register char *fullnamp;
@@ -71,7 +71,7 @@
     register char *p;
     register int slotnum;
 
-    if ((fullnamp = ttyname(fd)) == NULL) return NULL;
+    if ((fullnamp = p) == NULL) return NULL;
     if ((ttynamp = rindex(fullnamp, '/')) == NULL) {
         ttynamp = fullnamp;
     } else {
@@ -104,14 +104,14 @@
 char *ttyname();
 char *rindex();
 
-int ttyfdslot(fd)
-int fd;
+int ttyfdslot(p)
+char *p;
 {
     register char *fullnamp;
     register char *ttynamp;
     register int slotnum;
     register struct ttyent	*te ;
-    if ((fullnamp = ttyname(fd)) == NULL) return NULL;
+    if ((fullnamp = p) == NULL) return NULL;
     if ((ttynamp = rindex(fullnamp, '/')) == NULL) {
         ttynamp = fullnamp;
     } else {
