/* treat failure (-1) as if not member of any group */
ngroups = getgroups(0, 0);
if (ngroups > 0) {
- gidset = (GETGROUPS_T *) malloc(ngroups * sizeof(GETGROUPS_T));
+ gidset = new_array(GETGROUPS_T, ngroups);
ngroups = getgroups(ngroups, gidset);
}
}
void sig_int(void)
{
+ /* KLUGE: if the user hits Ctrl-C while ssh is prompting
+ * for a password, then our cleanup's sending of a SIGUSR1
+ * signal to all our children may kill ssh before it has a
+ * chance to restore the tty settings (i.e. turn echo back
+ * on). By sleeping for a short time, ssh gets a bigger
+ * chance to do the right thing. If child processes are
+ * not ssh waiting for a password, then this tiny delay
+ * shouldn't hurt anything. */
+ msleep(400);
exit_cleanup(RERR_SIGNAL);
}