comparison lib/pty.c @ 740:6968041e4b82

2006-5-14 Brian Masney <masneyb@gftp.org> * lib/pty.c (_gftp_ptym_open) - fixes for using the grantpt() function under HP/UX. (from Allyn Fratkin <allyn@fratkin.com>) (closes #301979)
author masneyb
date Sun, 14 May 2006 16:44:20 +0000
parents 4029ab7f13e4
children 1e07981f7511
comparison
equal deleted inserted replaced
739:ba82724da370 740:6968041e4b82
74 74
75 static int 75 static int
76 _gftp_ptym_open (char *pts_name, size_t len, int *fds) 76 _gftp_ptym_open (char *pts_name, size_t len, int *fds)
77 { 77 {
78 char *new_pts_name; 78 char *new_pts_name;
79 void (*savesig)();
79 int fdm; 80 int fdm;
80 81
81 if ((fdm = open ("/dev/ptmx", O_RDWR)) < 0) 82 if ((fdm = open ("/dev/ptmx", O_RDWR)) < 0)
82 return (GFTP_ERETRYABLE); 83 return (GFTP_ERETRYABLE);
83 84
85 savesig = signal (SIGCHLD, SIG_DFL);
84 if (grantpt (fdm) < 0) 86 if (grantpt (fdm) < 0)
85 { 87 {
88 signal(SIGCHLD, savesig);
86 close (fdm); 89 close (fdm);
87 return (GFTP_ERETRYABLE); 90 return (GFTP_ERETRYABLE);
88 } 91 }
92 signal (SIGCHLD, savesig);
89 93
90 if (unlockpt (fdm) < 0) 94 if (unlockpt (fdm) < 0)
91 { 95 {
92 close (fdm); 96 close (fdm);
93 return (GFTP_ERETRYABLE); 97 return (GFTP_ERETRYABLE);