--- Wnn/uum/jhlp.c.orig Thu Mar 9 16:34:56 2000 +++ Wnn/uum/jhlp.c Thu Mar 9 16:44:26 2000 @@ -80,6 +80,9 @@ jmp_buf kk_env; +#if (defined(__unix__) || defined(unix)) && !defined(USG) +#include +#endif #ifdef SYSVR2 # include #endif /* SYSVR2 */ @@ -168,12 +171,14 @@ strcpy(username, getpwuid(getuid())->pw_name); if((name = getenv(WNN_USERNAME_ENV)) != NULL){ - strcpy(username, name); + strncpy(username, name, PATHNAMELEN - 1); + username[PATHNAMELEN - 1] = '\0'; } for (i = 1; i < argc;) { if (!strcmp(argv[i++], "-L")) { if (i >= argc || argv[i][0] == '-') default_usage(); - strcpy(lang_dir, argv[i++]); + strncpy(lang_dir, argv[i++], 31); + lang_dir[31] = '\0'; for (;i < argc; i++) { argv[i - 2] = argv[i]; } @@ -233,8 +238,9 @@ server_env = WNN_DEF_SERVER_ENV; } if(name = getenv(server_env)) { - strcpy(def_servername, name); - strcpy(def_reverse_servername, name); + strncpy(def_servername, name, PATHNAMELEN - 1); + def_servername[PATHNAMELEN - 1] = '\0'; + strcpy(def_reverse_servername, def_servername); } } @@ -263,9 +269,11 @@ #if defined(BSD42) && !defined(DGUX) +#if !(defined(BSD) && (BSD >= 199306)) if (saveutmp() < 0) { puts("Can't save utmp\n"); } +#endif #endif /* BSD42 */ @@ -492,7 +500,8 @@ static int do_k_opt() { - strcpy(uumkey_name_in_uumrc, optarg); + strncpy(uumkey_name_in_uumrc, optarg, PATHNAMELEN - 1); + uumkey_name_in_uumrc[PATHNAMELEN - 1] = '\0'; if (*uumkey_name_in_uumrc == '\0') { return -1; } @@ -502,7 +511,8 @@ static int do_c_opt() { - strcpy(convkey_name_in_uumrc, optarg); + strncpy(convkey_name_in_uumrc, optarg, PATHNAMELEN - 1); + convkey_name_in_uumrc[PATHNAMELEN - 1] = '\0'; if (*convkey_name_in_uumrc == '\0') { return -1; } @@ -512,7 +522,8 @@ static int do_r_opt() { - strcpy(rkfile_name_in_uumrc, optarg); + strncpy(rkfile_name_in_uumrc, optarg, PATHNAMELEN - 1); + rkfile_name_in_uumrc[PATHNAMELEN - 1] = '\0'; if (*rkfile_name_in_uumrc == '\0') { return -1; } @@ -528,8 +539,9 @@ static int do_D_opt() { - strcpy(def_servername, optarg); - strcpy(def_reverse_servername, optarg); + strncpy(def_servername, optarg, PATHNAMELEN - 1); + def_servername[PATHNAMELEN - 1] = '\0'; + strcpy(def_reverse_servername, def_servername); if (*def_servername == '\0') { return -1; } @@ -538,7 +550,8 @@ static int do_n_opt() { - strcpy(username, optarg); + strncpy(username, optarg, PATHNAMELEN - 1); + username[PATHNAMELEN - 1] = '\0'; if (*username == '\0') { return -1; } @@ -771,7 +784,12 @@ #endif int pid; - if ((pid = wait3(&status, WNOHANG | WUNTRACED, NULL)) == child_id) { +/* + * Remove warning. + * Patched by Hidekazu Kuroki(hidekazu@cs.titech.ac.jp) 1996/8/20 + */ +/* if ((pid = wait3(&status, WNOHANG | WUNTRACED, NULL)) == child_id) { */ + if ((pid = wait3((int *)&status, WNOHANG | WUNTRACED, NULL)) == child_id) { if (WIFSTOPPED(status)) { #ifdef SIGCONT kill(pid, SIGCONT); @@ -1140,9 +1158,11 @@ setpgrp(0, pid); #endif /* BSD42 */ +#if !(defined(BSD) && (BSD >= 199306)) if (setutmp(ttypfd) == ERROR) { puts("Can't set utmp."); } +#endif #ifdef linux setsid(); @@ -1562,9 +1582,11 @@ perror(prog); } +#if !(defined(BSD) && (BSD >= 199306)) if (resetutmp(ttypfd) == ERROR) { printf("Can't reset utmp."); } +#endif #ifdef TIOCSSIZE pty_rowcol.ts_lines = 0; pty_rowcol.ts_cols = 0; @@ -1636,7 +1658,16 @@ char *b, *pty; int no; { +/* + * Change pseudo-devices. + * Because FreeBSD's master pseudo-devices are pty[p-sP-S][0-9a-v]. + * Patched by Hidekazu Kuroki(hidekazu@cs.titech.ac.jp) 1996/8/20 + */ +#if (defined(BSD) && (BSD >= 199306)) /* 4.4BSD-Lite by Taoka */ + sprintf(b, "%s%1c%1c", pty, "pqrsPQRS"[(no >> 5)], ((no & 0x1f > 9)? 'a' : '0') + (no & 0x1f)); +#else /* ! 4.4BSD-Lite */ sprintf(b, "%s%1c%1x", pty, 'p' + (no >> 4), no & 0x0f); +#endif /* ! 4.4BSD-Lite */ } #endif /* !sgi */