9 date 92.12.15.00.20.22; author jromine; state Exp;
14 date 92.12.14.17.54.23; author jromine; state Exp;
19 date 90.04.05.15.31.24; author sources; state Exp;
24 date 90.04.05.14.45.40; author sources; state Exp;
29 date 90.02.06.13.09.01; author sources; state Exp;
34 date 90.02.05.14.23.05; author sources; state Exp;
39 date 90.02.05.14.22.58; author sources; state Exp;
53 @/* m_update.c - update the profile */
55 static char ident[] = "@@(#)$Id: m_update.c,v 1.6 1992/12/14 17:54:23 jromine Exp jromine $";
62 #define sigmask(s) (1 << ((s) - 1))
63 #endif /* not sigmask */
65 static int m_chkids();
70 TYPESIG (*hstat) (), (*istat) (), (*qstat) (), (*tstat) ();
74 register struct node *np;
77 if (!(ctxflags & CTXMOD))
81 if ((action = m_chkids ()) > OK)
82 return; /* child did it for us */
85 hstat = signal (SIGHUP, SIG_IGN);
86 istat = signal (SIGINT, SIG_IGN);
87 qstat = signal (SIGQUIT, SIG_IGN);
88 tstat = signal (SIGTERM, SIG_IGN);
90 smask = sigblock (sigmask (SIGHUP) | sigmask (SIGINT)
91 | sigmask (SIGQUIT) | sigmask (SIGTERM));
94 if ((out = fopen (ctxpath, "w")) == NULL)
95 adios (ctxpath, "unable to write");
96 for (np = m_defs; np; np = np -> n_next)
98 fprintf (out, "%s: %s\n", np -> n_name, np -> n_field);
102 (void) signal (SIGHUP, hstat);
103 (void) signal (SIGINT, istat);
104 (void) signal (SIGQUIT, qstat);
105 (void) signal (SIGTERM, tstat);
107 (void) sigsetmask (smask);
110 _exit (0); /* we are child, time to die */
115 /* This hack brought to you so we can handle set[ug]id MH programs. If we
116 return NOTOK, then no fork is made, we update .mh_profile normally, and
117 return to the caller normally. If we return 0, then the child is
118 executing, .mh_profile is modified after we set our [ug]ids to the norm.
119 If we return > 0, then the parent is executed and .mh_profile has
120 already be modified. We can just return to the caller immediately. */
123 static int m_chkids () {
127 if (getuid () == geteuid ())
130 for (i = 0; (child_id = fork ()) == -1 && i < 5; i++)
137 (void) setgid (getgid ());
138 (void) setuid (getuid ());
142 (void) pidwait (child_id, NOTOK);
153 @*** empty log message ***
158 static char ident[] = "@@(#)$Id: m_update.c,v 1.5 1990/04/05 15:31:24 sources Exp jromine $";
190 static char ident[] = "@@(#)$Id:$";
201 static char ident[] = "$Id:";
230 int (*hstat) (), (*istat) (), (*qstat) (), (*tstat) ();