- if ((p->p_flag & P_CONTROLT) && p->p_pgrp->pg_session->s_ttyp)
- an_acct.ac_tty = p->p_pgrp->pg_session->s_ttyp->t_dev;
- else
+
+ sessp = proc_session(p);
+ if ((p->p_flag & P_CONTROLT) && (sessp != SESSION_NULL) && (sessp->s_ttyp != TTY_NULL)) {
+ fstate = thread_funnel_set(kernel_flock, TRUE);
+ an_acct.ac_tty = sessp->s_ttyp->t_dev;
+ (void) thread_funnel_set(kernel_flock, fstate);
+ }else