|
@@ -6,7 +6,6 @@
|
|
|
#include <string.h>
|
|
|
#include <stdlib.h>
|
|
|
#include "syscall.h"
|
|
|
-#include "kstat.h"
|
|
|
|
|
|
#define MAXTRIES 100
|
|
|
|
|
@@ -37,11 +36,10 @@ char *tempnam(const char *dir, const char *pfx)
|
|
|
|
|
|
for (try=0; try<MAXTRIES; try++) {
|
|
|
__randname(s+l-6);
|
|
|
-#ifdef SYS_lstat
|
|
|
- r = __syscall(SYS_lstat, s, &(struct kstat){0});
|
|
|
+#ifdef SYS_readlink
|
|
|
+ r = __syscall(SYS_readlink, s, (char[1]){0}, 1);
|
|
|
#else
|
|
|
- r = __syscall(SYS_fstatat, AT_FDCWD, s,
|
|
|
- &(struct kstat){0}, AT_SYMLINK_NOFOLLOW);
|
|
|
+ r = __syscall(SYS_readlinkat, AT_FDCWD, s, (char[1]){0}, 1);
|
|
|
#endif
|
|
|
if (r == -ENOENT) return strdup(s);
|
|
|
}
|