Mercurial > repos > blastem
comparison util.c @ 763:2a25ea5d94f7
Fix sense of HAS_PROC check
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 28 Jun 2015 19:23:38 -0700 |
parents | 206c449eaa81 |
children | 13d3744b170e |
comparison
equal
deleted
inserted
replaced
762:206c449eaa81 | 763:2a25ea5d94f7 |
---|---|
137 char * get_exe_dir() | 137 char * get_exe_dir() |
138 { | 138 { |
139 static char * exe_dir; | 139 static char * exe_dir; |
140 if (!exe_dir) { | 140 if (!exe_dir) { |
141 char * cur; | 141 char * cur; |
142 #ifndef HAS_PROC | 142 #ifdef HAS_PROC |
143 char * linktext = readlink_alloc("/proc/self/exe"); | 143 char * linktext = readlink_alloc("/proc/self/exe"); |
144 if (!linktext) { | 144 if (!linktext) { |
145 goto fallback; | 145 goto fallback; |
146 } | 146 } |
147 int linksize = strlen(linktext); | 147 int linksize = strlen(linktext); |
167 memcpy(exe_dir, exe_str, cur-exe_str); | 167 memcpy(exe_dir, exe_str, cur-exe_str); |
168 exe_dir[cur-exe_str] = 0; | 168 exe_dir[cur-exe_str] = 0; |
169 break; | 169 break; |
170 } | 170 } |
171 } | 171 } |
172 #ifndef HAS_PROC | 172 #ifdef HAS_PROC |
173 } else { | 173 } else { |
174 exe_dir = linktext; | 174 exe_dir = linktext; |
175 } | 175 } |
176 #endif | 176 #endif |
177 } | 177 } |