/[baselayout]/trunk/src/runscript.c
Gentoo

Diff of /trunk/src/runscript.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 2549 Revision 2550
134 134
135 if (! pathname) 135 if (! pathname)
136 return (0); 136 return (0);
137 137
138 retval = follow_link ? stat (pathname, &buf) : lstat (pathname, &buf); 138 retval = follow_link ? stat (pathname, &buf) : lstat (pathname, &buf);
139 if (retval == 0) 139 if (! retval)
140 return (buf.st_mtime); 140 return (buf.st_mtime);
141 141
142 errno = 0; 142 errno = 0;
143 return (0); 143 return (0);
144} 144}
152 int i = 0; 152 int i = 0;
153 153
154 if (sighup) 154 if (sighup)
155 return (false); 155 return (false);
156 156
157 if (mtime_test == NULL || ! rc_exists (mtime_test)) 157 if (! mtime_test || ! rc_exists (mtime_test))
158 return (false); 158 return (false);
159 159
160 if (rc_service_state (applet, rc_service_stopped)) 160 if (rc_service_state (applet, rc_service_stopped))
161 return (false); 161 return (false);
162 162
163 if ((mtime = get_mtime (mtime_test, false)) == 0) 163 if (! (mtime = get_mtime (mtime_test, false)))
164 return (false); 164 return (false);
165 165
166 while (tests[i]) 166 while (tests[i])
167 { 167 {
168 path = rc_strcatpaths (RC_SVCDIR, tests[i], applet, (char *) NULL); 168 path = rc_strcatpaths (RC_SVCDIR, tests[i], applet, (char *) NULL);
212 rc_strlist_free (providelist); 212 rc_strlist_free (providelist);
213 if (restart_services) 213 if (restart_services)
214 rc_strlist_free (restart_services); 214 rc_strlist_free (restart_services);
215 if (need_services) 215 if (need_services)
216 rc_strlist_free (need_services); 216 rc_strlist_free (need_services);
217 if (tmplist)
218 rc_strlist_free (tmplist);
217 if (mycmd) 219 if (mycmd)
218 free (mycmd); 220 free (mycmd);
219 if (myarg1) 221 if (myarg1)
220 free (myarg1); 222 free (myarg1);
221 if (myarg2) 223 if (myarg2)
310 312
311 /* Done, so restore the signal handler */ 313 /* Done, so restore the signal handler */
312 signal (SIGCHLD, handle_signal); 314 signal (SIGCHLD, handle_signal);
313 315
314 if (WIFEXITED (status)) 316 if (WIFEXITED (status))
315 return (WEXITSTATUS (status) == 0 ? true : false); 317 return (WEXITSTATUS (status) ? false : true);
316 318
317 return (false); 319 return (false);
318} 320}
319 321
320static rc_service_state_t svc_status (const char *service) 322static rc_service_state_t svc_status (const char *service)
512 STRLIST_FOREACH (services, svc, i) 514 STRLIST_FOREACH (services, svc, i)
513 { 515 {
514 if (rc_service_state (svc, rc_service_started)) 516 if (rc_service_state (svc, rc_service_started))
515 continue; 517 continue;
516 if (! rc_wait_service (svc)) 518 if (! rc_wait_service (svc))
517 { eerror ("%s: timed out waiting for %s", applet, svc); 519 eerror ("%s: timed out waiting for %s", applet, svc);
518 system ("ps ax > /tmp/$SVCNAME.waiting"); }
519 if (rc_service_state (svc, rc_service_started)) 520 if (rc_service_state (svc, rc_service_started))
520 continue; 521 continue;
521 522
522 STRLIST_FOREACH (need_services, svc2, j) 523 STRLIST_FOREACH (need_services, svc2, j)
523 if (strcmp (svc, svc2) == 0) 524 if (strcmp (svc, svc2) == 0)
558 559
559 len += strlen (svc) + 2; 560 len += strlen (svc) + 2;
560 n++; 561 n++;
561 } 562 }
562 563
564 len += 5;
563 tmp = rc_xmalloc (sizeof (char *) * len + 5); 565 tmp = rc_xmalloc (sizeof (char *) * len);
564 p = tmp; 566 p = tmp;
565 STRLIST_FOREACH (tmplist, svc, i) 567 STRLIST_FOREACH (tmplist, svc, i)
566 { 568 {
567 if (i > 1) 569 if (i > 1)
568 { 570 {
569 if (i == n - 1) 571 if (i == n - 1)
570 p += sprintf (p, " or "); 572 p += snprintf (p, len, " or ");
571 else 573 else
572 p += sprintf (p, ", "); 574 p += snprintf (p, len, ", ");
573 } 575 }
574 p += sprintf (p, "%s", svc); 576 p += snprintf (p, len, "%s", svc);
575 } 577 }
576 ewarnx ("WARNING: %s is scheduled to start when %s has started", 578 ewarnx ("WARNING: %s is scheduled to start when %s has started",
577 applet, tmp); 579 applet, tmp);
578 } 580 }
579 581

Legend:
Removed from v.2549  
changed lines
  Added in v.2550

  ViewVC Help
Powered by ViewVC 1.1.20