diff options
Diffstat (limited to 'guts/symlinkat.c')
-rw-r--r-- | guts/symlinkat.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/guts/symlinkat.c b/guts/symlinkat.c new file mode 100644 index 0000000..5f1cc59 --- /dev/null +++ b/guts/symlinkat.c @@ -0,0 +1,38 @@ +/* + * static int + * wrap_symlinkat(const char *oldpath, int dirfd, const char *newpath) { + * int rc = -1; + */ + struct stat64 buf; + +#ifdef PSEUDO_NO_REAL_AT_FUNCTIONS + if (dirfd != AT_FDCWD) { + errno = ENOSYS; + return -1; + } + rc = real_symlink(oldpath, newpath); +#else + rc = real_symlinkat(oldpath, dirfd, newpath); +#endif + + if (rc == -1) { + return rc; + } +#ifdef PSEUDO_NO_REAL_AT_FUNCTIONS + rc = real___lxstat64(_STAT_VER, newpath, &buf); +#else + rc = real___fxstatat64(_STAT_VER, dirfd, newpath, &buf, AT_SYMLINK_NOFOLLOW); +#endif + if (rc == -1) { + int save_errno = errno; + pseudo_diag("symlinkat: couldn't stat '%s' even though symlink creation succeeded (%s).\n", + newpath, strerror(errno)); + errno = save_errno; + return rc; + } + /* just record the entry */ + pseudo_client_op(OP_SYMLINK, AT_SYMLINK_NOFOLLOW, -1, dirfd, newpath, &buf); + +/* return rc; + * } + */ |