Skip to content

Instantly share code, notes, and snippets.

Created Aug 13, 2020
What would you like to do?
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <assert.h>
static void interrupted(int s) {
write(1, "interrupted\n", 12);
int main() {
char c[256];
errno = 0;
assert(!signal(SIGINT, interrupted));
ssize_t r = read(0, c, sizeof(c));
printf("r=%zd errno=%d (%s)\n", r, errno, strerror(errno));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment