forked from mirror/dwm
comment out post return
This commit is contained in:
parent
7abf5c99c4
commit
db356cc2b1
1 changed files with 33 additions and 33 deletions
|
@ -25,39 +25,39 @@ char *get_dwm_path(){
|
||||||
return "/run/current-system/sw/bin/dwm";
|
return "/run/current-system/sw/bin/dwm";
|
||||||
|
|
||||||
// https://en.wikibooks.org/wiki/C_Programming/POSIX_Reference/sys/stat.h#Member_types
|
// https://en.wikibooks.org/wiki/C_Programming/POSIX_Reference/sys/stat.h#Member_types
|
||||||
struct stat s;
|
// struct stat s;
|
||||||
int r, length, rate = 42;
|
// int r, length, rate = 42;
|
||||||
char *path = NULL;
|
// char *path = NULL;
|
||||||
|
//
|
||||||
if(lstat("/proc/self/exe", &s) == -1){
|
// if(lstat("/proc/self/exe", &s) == -1){
|
||||||
perror("lstat:");
|
// perror("lstat:");
|
||||||
return NULL;
|
// return NULL;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
length = s.st_size + 1 - rate;
|
// length = s.st_size + 1 - rate;
|
||||||
|
//
|
||||||
do{
|
// do{
|
||||||
length+=rate;
|
// length+=rate;
|
||||||
|
//
|
||||||
free(path);
|
// free(path);
|
||||||
path = malloc(sizeof(char) * length);
|
// path = malloc(sizeof(char) * length);
|
||||||
|
//
|
||||||
if(path == NULL){
|
// if(path == NULL){
|
||||||
perror("malloc:");
|
// perror("malloc:");
|
||||||
return NULL;
|
// return NULL;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
r = readlink("/proc/self/exe", path, length);
|
// r = readlink("/proc/self/exe", path, length);
|
||||||
|
//
|
||||||
if(r == -1){
|
// if(r == -1){
|
||||||
perror("readlink:");
|
// perror("readlink:");
|
||||||
return NULL;
|
// return NULL;
|
||||||
}
|
// }
|
||||||
}while(r >= length);
|
// }while(r >= length);
|
||||||
|
//
|
||||||
path[r] = '\0';
|
// path[r] = '\0';
|
||||||
|
//
|
||||||
return path;
|
// return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue