diff --git a/selfrestart.c b/selfrestart.c index 097d2ec..ca98d8c 100644 --- a/selfrestart.c +++ b/selfrestart.c @@ -25,39 +25,39 @@ char *get_dwm_path(){ return "/run/current-system/sw/bin/dwm"; // https://en.wikibooks.org/wiki/C_Programming/POSIX_Reference/sys/stat.h#Member_types - struct stat s; - int r, length, rate = 42; - char *path = NULL; - - if(lstat("/proc/self/exe", &s) == -1){ - perror("lstat:"); - return NULL; - } - - length = s.st_size + 1 - rate; - - do{ - length+=rate; - - free(path); - path = malloc(sizeof(char) * length); - - if(path == NULL){ - perror("malloc:"); - return NULL; - } - - r = readlink("/proc/self/exe", path, length); - - if(r == -1){ - perror("readlink:"); - return NULL; - } - }while(r >= length); - - path[r] = '\0'; - - return path; + // struct stat s; + // int r, length, rate = 42; + // char *path = NULL; + // + // if(lstat("/proc/self/exe", &s) == -1){ + // perror("lstat:"); + // return NULL; + // } + // + // length = s.st_size + 1 - rate; + // + // do{ + // length+=rate; + // + // free(path); + // path = malloc(sizeof(char) * length); + // + // if(path == NULL){ + // perror("malloc:"); + // return NULL; + // } + // + // r = readlink("/proc/self/exe", path, length); + // + // if(r == -1){ + // perror("readlink:"); + // return NULL; + // } + // }while(r >= length); + // + // path[r] = '\0'; + // + // return path; } /**