Skip to content

Instantly share code, notes, and snippets.

@raduraducu
Created September 16, 2013 11:11
Show Gist options
  • Save raduraducu/6579324 to your computer and use it in GitHub Desktop.
Save raduraducu/6579324 to your computer and use it in GitHub Desktop.
file name from descriptor
char *buf;
buf = (char *)calloc(1024, sizeof(char));
fcntl(STDERR_FILENO, F_GETPATH, buf);
printf("----------------- old log path: %s\n", buf);
int retValue = dup2(fd, STDERR_FILENO);
free(buf);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment