⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pathexec_run.c

📁 daemontools-0.76.tar.gz是在linux环境下自动监控进程的源程序
💻 C
字号:
/* Public domain. */#include "error.h"#include "stralloc.h"#include "str.h"#include "env.h"#include "pathexec.h"static stralloc tmp;void pathexec_run(const char *file,const char * const *argv,const char * const *envp){  const char *path;  unsigned int split;  int savederrno;  if (file[str_chr(file,'/')]) {    execve(file,argv,envp);    return;  }  path = env_get("PATH");  if (!path) path = "/bin:/usr/bin";  savederrno = 0;  for (;;) {    split = str_chr(path,':');    if (!stralloc_copyb(&tmp,path,split)) return;    if (!split)      if (!stralloc_cats(&tmp,".")) return;    if (!stralloc_cats(&tmp,"/"))  return;    if (!stralloc_cats(&tmp,file)) return;    if (!stralloc_0(&tmp)) return;    execve(tmp.s,argv,envp);    if (errno != error_noent) {      savederrno = errno;      if ((errno != error_acces) && (errno != error_perm) && (errno != error_isdir)) return;    }    if (!path[split]) {      if (savederrno) errno = savederrno;      return;    }    path += split;    path += 1;  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -