#include <cstdio> #include <linux/limits.h> #include <unistd.h> #include <libgen.h> int main(int argc, char *argv[]) { char here_path[PATH_MAX]; char script_path[PATH_MAX]; if (readlink("/proc/self/exe", here_path, PATH_MAX) == -1) { perror("readlink"); return -1; } // if (setresuid(0,0,0)) { // perror("setresuid"); // return -1; //} snprintf(script_path, sizeof(script_path), "%s/pcie40_reload.sh", dirname(here_path)); return execvp(script_path, argv); }