Skip to content

Instantly share code, notes, and snippets.

@raphael
Created March 25, 2009 17:48
Show Gist options
  • Save raphael/85602 to your computer and use it in GitHub Desktop.
Save raphael/85602 to your computer and use it in GitHub Desktop.
#include <sys/types.h> /* See NOTES */
#include <sys/socket.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
int main() {
int fd[2];
int r = pipe(fd);
if (getsockopt(fd[0], SOL_SOCKET, 0, NULL,NULL) == ENOTSOCK) {
printf ("Woohoo!\n");
} else {
printf ("Oh noes\n");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment