diff options
Diffstat (limited to 'guts/symlinkat.c')
-rw-r--r-- | guts/symlinkat.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/guts/symlinkat.c b/guts/symlinkat.c index 5f1cc59..df1df06 100644 --- a/guts/symlinkat.c +++ b/guts/symlinkat.c @@ -1,21 +1,23 @@ /* * static int - * wrap_symlinkat(const char *oldpath, int dirfd, const char *newpath) { + * wrap_symlinkat(const char *oldname, int dirfd, const char *newpath) { * int rc = -1; */ struct stat64 buf; + char *roldname = 0; #ifdef PSEUDO_NO_REAL_AT_FUNCTIONS if (dirfd != AT_FDCWD) { errno = ENOSYS; return -1; } - rc = real_symlink(oldpath, newpath); + rc = real_symlink(roldname ? roldname : oldname, newpath); #else - rc = real_symlinkat(oldpath, dirfd, newpath); + rc = real_symlinkat(roldname ? roldname : oldname, dirfd, newpath); #endif if (rc == -1) { + free(roldname); return rc; } #ifdef PSEUDO_NO_REAL_AT_FUNCTIONS @@ -28,10 +30,13 @@ pseudo_diag("symlinkat: couldn't stat '%s' even though symlink creation succeeded (%s).\n", newpath, strerror(errno)); errno = save_errno; + free(roldname); return rc; } /* just record the entry */ - pseudo_client_op(OP_SYMLINK, AT_SYMLINK_NOFOLLOW, -1, dirfd, newpath, &buf); + pseudo_client_op(OP_SYMLINK, -1, dirfd, newpath, &buf); + + free(roldname); /* return rc; * } |