Skip to content

Instantly share code, notes, and snippets.

@coyotebush
Created December 12, 2012 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coyotebush/4271680 to your computer and use it in GitHub Desktop.
Save coyotebush/4271680 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
int main () {
printf("1: %s\n", getenv("PWD"));
setenv("PWD", "/etc", 1);
printf("2: %s\n", getenv("PWD"));
execl("/usr/bin/printenv", "/usr/bin/printenv", "PWD", NULL);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment