make all objects used with atomic operations volatile
[musl] / src / misc / get_current_dir_name.c
index e0f463b..782cddc 100644 (file)
@@ -1,3 +1,4 @@
+#define _GNU_SOURCE
 #include <stdlib.h>
 #include <string.h>
 #include <limits.h>
@@ -6,11 +7,9 @@
 
 char *get_current_dir_name(void) {
        struct stat a, b;
-       char buf[PATH_MAX];
        char *res = getenv("PWD");
        if (res && *res && !stat(res, &a) && !stat(".", &b)
            && (a.st_dev == b.st_dev) && (a.st_ino == b.st_ino))
                return strdup(res);
-       if(!getcwd(buf, sizeof(buf))) return NULL;
-       return strdup(buf);
+       return getcwd(0, 0);
 }