diff -Naur installwatch-0.6.3/installwatch.c installwatch-0.6.3-lunar/installwatch.c --- installwatch-0.6.3/installwatch.c 2017-07-15 19:47:42.673154410 +0200 +++ installwatch-0.6.3-lunar/installwatch.c 2017-07-15 21:30:18.353210432 +0200 @@ -74,6 +74,7 @@ static int(*true_rename)(const char *, const char *); static int(*true_rmdir)(const char *); static int(*true_symlink)(const char *, const char *); +static int(*true_symlinkat)(const char *, int, const char*); static int(*true_truncate)(const char *, TRUNCATE_T); static int(*true_unlink)(const char *); @@ -130,6 +131,7 @@ true_rename = dlsym(libc_handle, "rename"); true_rmdir = dlsym(libc_handle, "rmdir"); true_symlink = dlsym(libc_handle, "symlink"); + true_symlinkat = dlsym(libc_handle, "symlinkat"); true_truncate = dlsym(libc_handle, "truncate"); true_unlink = dlsym(libc_handle, "unlink"); @@ -935,6 +937,30 @@ return result; } +int symlinkat(const char *oldpath, int newdirfd, const char *newpath) { + int result; + char old_canonic[MAXPATHLEN], new_canonic[MAXPATHLEN]; + + if (newdirfd == AT_FDCWD || *newpath == '/') { +#if DEBUG + fprintf (stderr, "symlinkat(%s, %d, %s)\n", oldpath, newdirfd, newpath); +#endif + return symlink(oldpath, newpath); + } + + REFCOUNT; + +#if DEBUG + fprintf (stderr, "symlinkat(%s, %d, %s)\n", oldpath, newdirfd, newpath); +#endif + + canonicalize(oldpath, old_canonic); + canonicalize_link(newpath, new_canonic); + result = true_symlinkat(oldpath, newdirfd, newpath); + log("%d\tsymlinkat\t%s\t%s\t#%s\n", result, old_canonic, new_canonic, error(result)); + return result; +} + int truncate(const char *path, TRUNCATE_T length) { int result; char canonic[MAXPATHLEN];