comment out post return

This commit is contained in:
Zynh Ludwig 2024-11-24 03:03:37 -08:00
parent 7abf5c99c4
commit db356cc2b1

View file

@ -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;
}
/**