Skip to content

Instantly share code, notes, and snippets.

@shakalaca
Created January 15, 2020 22:43
Show Gist options
  • Save shakalaca/fca3088b8c8103a4da5529b893eedd99 to your computer and use it in GitHub Desktop.
Save shakalaca/fca3088b8c8103a4da5529b893eedd99 to your computer and use it in GitHub Desktop.
#include <dirent.h>
#include <stdio.h>
#include <unistd.h>
int main() {
DIR* dir = opendir(".");
int ret = 0;
char buf[4096];
symlink("/root/v86d", "test");
ret = readlinkat(dirfd(dir), "test", buf, sizeof(buf));
printf("ret: %d\n", ret);
unlink("test");
closedir(dir);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment