try to fix cwd

This commit is contained in:
Julian Daube 2017-10-08 03:54:31 +02:00
parent 72e80721e8
commit ec61e1f9e5
1 changed files with 2 additions and 2 deletions

View File

@ -257,12 +257,12 @@ inline bool PathRelative(std::string path) {
#include <unistd.h>
std::string cwd() {
ssize_t size = 100, nsize;
ssize_t size = 1000, nsize;
while(1) {
char buffer[size];
if ((nsize = readlink("/proc/self/cwd", buffer, size)) < size) {
buffer[size+1] = 0;
buffer[size] = 0;
return std::string(buffer);
}
size = nsize + 100;