try to fix cwd

This commit is contained in:
Julian Daube 2017-10-08 03:54:31 +02:00
parent 72e80721e8
commit ec61e1f9e5

View File

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