The process received a SIGPIPE
. The default behaviour for this signal is to end the process.
A SIGPIPE
is sent to a process if it tried to write to a socket that had been shutdown for writing or isn’t connected (anymore).
To avoid that the program ends in this case, you could either
- make the process ignore
SIGPIPE
#include <signal.h> int main(void) { sigaction(SIGPIPE, &(struct sigaction){SIG_IGN}, NULL); ...
or - install an explicit handler for
SIGPIPE
(typically doing nothing):#include <signal.h> void sigpipe_handler(int unused) { } int main(void) { sigaction(SIGPIPE, &(struct sigaction){sigpipe_handler}, NULL); ...
In both cases send*()
/write()
would return -1
and set errno
to EPIPE
.
Related Posts:
- pthread_join() and pthread_exit()
- What can be the reasons of connection refused errors?
- Undefined reference to pthread_create in Linux
- Undefined reference to pthread_create
- Bad File Descriptor with Linux Socket write() Bad File Descriptor C
- Cannot assign requested address – possible causes?
- Connect: Socket operation on non-socket
- Connect: Socket operation on non-socket
- Cannot assign requested address – possible causes?
- connect Error: “No route to host”
- No Symbol Table using GDB on Compiled Programs
- Does connect() block for TCP socket?
- Understanding INADDR_ANY for socket programming
- Display value found at given address gdb
- What can cause a “Resource temporarily unavailable” on sock send() command
- PTHREAD_MUTEX_INITIALIZER vs pthread_mutex_init ( &mutex, param)
- GDB no such file or directory
- How big can a 64 bit unsigned integer be?
- How to use execvp()
- How to use execvp() to execute a command
- How does strtok() split the string into tokens in C?
- What is *(uint32_t*)?
- what is Segmentation fault (core dumped)? [duplicate]
- How to convert an int to string in C?
- How to print in C
- Why should we typedef a struct so often in C?
- What is a string of hexadecimal digits?
- What is newline character — ‘\n’
- Why does ENOENT mean “No such file or directory”?
- What does the question mark character (‘?’) mean?
- makefile:4: *** missing separator. Stop
- Stack smashing detected
- How do I determine the size of my array in C?
- What is the difference between C and embedded C?
- Difference between malloc and calloc?
- What is Bit Masking?
- segmentation fault : 11
- What are .a and .so files?
- So what does “return 0” actually mean?
- warning: assignment makes integer from pointer without a cast
- Why use bzero over memset?
- what is the meaning of == sign?
- How do I use extern to share variables between source files?
- ARM Assembler – How do I use CMP, BLT and BGT?
- Invalid read of size 8 – Valgrind + C
- error: called object is not a function or function pointer
- munmap_chunk(): invalid pointer
- warning: incompatible implicit declaration of built-in function ‘xyz’
- strcpy vs strdup
- Warning comparison between pointer and integer in C language
- What is char ** in C?
- Difference between scanf() and fgets()
- Return char[]/string from a function [duplicate]
- Is there a printf converter to print in binary format?
- Difference between char* and const char*?
- How to read from stdin with fgets()?
- Output single character in C
- Converting a C program to MIPS
- Why am I getting “array initializer must be an initializer list or string literal”?
- C: linker command failed with exit code 1
- #31 expression must have integral type
- How do you pass a function as a parameter in C?
- What’s the equivalent of new/delete of C++ in C?
- sizeof float (3.0) vs (3.0f)
- How to trigger SIGUSR1 and SIGUSR2?
- What does “%.*s” mean in printf?
- Does C have a “foreach” loop construct?
- What is a bus error? Is it different from a segmentation fault?
- Array definition – Expression must have a constant value
- Constant pointer vs Pointer to constant
- What is the cause of flexible array member not at end of struct error?
- Variable warning set but not used
- Expected declaration specifier error in function
- How can I get argv[] as int?
- Why I do get “Cannot find bound of current function” when I overwrite the ret address of a vulnerable program?
- valgrind – Address —- is 0 bytes after a block of size 8 alloc’d
- strcmp not working
- error: aggregate value used where an integer was expected
- char pointers: invalid conversion from ‘char*’ to ‘char’?
- What’s the difference between nexti and stepi in gdb?
- How does one represent the empty char?
- Removing trailing newline character from fgets() input
- Unknown ending signal when using debugger gdb
- “Multiple definition”, “first defined here” errors
- How can one see content of stack with GDB?
- Does C have a string type?
- how use EOF stdin in C
- Execution of printf() and Segmentation Fault
- How does the strtok function in C work? [duplicate]
- error: function returns address of local variable
- Return a `struct` from a function in C
- Reaching EOF with fgets
- C: scanf to array
- What are “prototypes” in a C program?
- What’s the difference between “mod” and “remainder”?
- undefined reference to `std::ios_base::Init::Init()’
- previous declaration of ‘function’ was here in C [duplicate]
- gdb: No symbol “i” in current context
- How to Compare 2 Character Arrays [duplicate]
- error: `itoa` was not declared in this scope