/[baselayout]/trunk/src/start-stop-daemon.c
Gentoo

Diff of /trunk/src/start-stop-daemon.c

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

Revision 2910 Revision 2911
858 ioctl(tty_fd, TIOCNOTTY, 0); 858 ioctl(tty_fd, TIOCNOTTY, 0);
859 close(tty_fd); 859 close(tty_fd);
860#endif 860#endif
861 861
862 /* Clean the environment of any RC_ variables */ 862 /* Clean the environment of any RC_ variables */
863 STRLIST_FOREACH (environ, env, i) 863 STRLIST_FOREACH (environ, env, i) {
864 if (env && strncmp (env, "RC_", 3) != 0) { 864 if (strncmp (env, "RC_", 3) == 0 ||
865 strncmp (env, "SSD_NICELEVEL=", strlen ("SSD_NICELEVEL=")) == 0)
866 continue;
867
865 /* For the path r, remove the rcscript bin dir from it */ 868 /* For the path, remove the rcscript bin dir from it */
866 if (strncmp (env, "PATH=" RC_LIBDIR "/bin:", 869 if (strncmp (env, "PATH=", 5) == 0) {
867 strlen ("PATH=" RC_LIBDIR "/bin:")) == 0)
868 {
869 char *path = env; 870 char *path = rc_xstrdup (env);
870 char *newpath; 871 char *newpath = NULL;
871 int len; 872 char *p = path;
872 path += strlen ("PATH=" RC_LIBDIR "/bin:"); 873 char *token;
873 len = sizeof (char *) * strlen (path) + 6; 874
874 newpath = rc_xmalloc (len); 875 p += 5;
876 while ((token = strsep (&p, ":"))) {
877 if (strcmp (token, RC_LIBDIR "/bin") == 0 ||
878 strcmp (token, RC_LIBDIR "/sbin") == 0)
879 continue;
880
881 if (newpath)
882 asprintf (&newpath, "%s:%s", newpath, token);
883 else
875 snprintf (newpath, len, "PATH=%s", path); 884 asprintf (&newpath, "PATH=%s", token);
885 }
876 rc_strlist_add (&newenv, newpath); 886 rc_strlist_add (&newenv, newpath);
887 free (path);
877 free (newpath); 888 free (newpath);
878 } else 889 } else
879 rc_strlist_add (&newenv, env); 890 rc_strlist_add (&newenv, env);
880 } 891 }
892
893 STRLIST_FOREACH (newenv, env, i)
894 einfo ("env %s", env);
881 895
882 umask (022); 896 umask (022);
883 897
884 stdout_fd = devnull_fd; 898 stdout_fd = devnull_fd;
885 stderr_fd = devnull_fd; 899 stderr_fd = devnull_fd;

Legend:
Removed from v.2910  
changed lines
  Added in v.2911

  ViewVC Help
Powered by ViewVC 1.1.20