Skip to content

Instantly share code, notes, and snippets.

@ha7ilm
Last active December 2, 2015 19:49
Show Gist options
  • Save ha7ilm/52171f12b690e54250dc to your computer and use it in GitHub Desktop.
Save ha7ilm/52171f12b690e54250dc to your computer and use it in GitHub Desktop.
stdin behaviour test
#include <stdio.h>
#include <unistd.h>
int main()
{
pid_t p;
int stat;
int i;
if(!(p = fork()))
{
execl("/bin/bash","bash", "-c","csdr through >/dev/null",NULL);
fprintf(stderr, "child failed to execl, now exits...\n"); return;
}
fprintf(stderr, "parent wait\n");
while(1) wait(&stat);
fprintf(stderr, "parent exited\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment