Loading cmds/bugreportz/bugreportz.cpp +1 −4 Original line number Diff line number Diff line Loading @@ -55,7 +55,7 @@ int bugreportz(int s, bool show_progress) { errno = ETIMEDOUT; } printf("FAIL:Bugreport read terminated abnormally (%s)\n", strerror(errno)); break; return EXIT_FAILURE; } // Writes line by line. Loading @@ -71,8 +71,5 @@ int bugreportz(int s, bool show_progress) { // Process final line, in case it didn't finish with newline write_line(line, show_progress); if (close(s) == -1) { fprintf(stderr, "WARNING: error closing socket: %s\n", strerror(errno)); } return EXIT_SUCCESS; } cmds/bugreportz/bugreportz.h +1 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ #define BUGREPORTZ_H // Calls dumpstate using the given socket and output its result to stdout. // Ownership of the socket is not transferred. int bugreportz(int s, bool show_progress); #endif // BUGREPORTZ_H cmds/bugreportz/main.cpp +11 −3 Original line number Diff line number Diff line Loading @@ -82,7 +82,7 @@ int main(int argc, char* argv[]) { if (s == -1) { printf("FAIL:Failed to connect to dumpstatez service: %s\n", strerror(errno)); return EXIT_SUCCESS; return EXIT_FAILURE; } // Set a timeout so that if nothing is read in 10 minutes, we'll stop Loading @@ -92,8 +92,16 @@ int main(int argc, char* argv[]) { tv.tv_sec = 10 * 60; tv.tv_usec = 0; if (setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) == -1) { fprintf(stderr, "WARNING: Cannot set socket timeout: %s\n", strerror(errno)); fprintf(stderr, "WARNING: Cannot set socket timeout, bugreportz might hang indefinitely: %s\n", strerror(errno)); } bugreportz(s, show_progress); int ret = bugreportz(s, show_progress); if (close(s) == -1) { fprintf(stderr, "WARNING: error closing socket: %s\n", strerror(errno)); ret = EXIT_FAILURE; } return ret; } Loading
cmds/bugreportz/bugreportz.cpp +1 −4 Original line number Diff line number Diff line Loading @@ -55,7 +55,7 @@ int bugreportz(int s, bool show_progress) { errno = ETIMEDOUT; } printf("FAIL:Bugreport read terminated abnormally (%s)\n", strerror(errno)); break; return EXIT_FAILURE; } // Writes line by line. Loading @@ -71,8 +71,5 @@ int bugreportz(int s, bool show_progress) { // Process final line, in case it didn't finish with newline write_line(line, show_progress); if (close(s) == -1) { fprintf(stderr, "WARNING: error closing socket: %s\n", strerror(errno)); } return EXIT_SUCCESS; }
cmds/bugreportz/bugreportz.h +1 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ #define BUGREPORTZ_H // Calls dumpstate using the given socket and output its result to stdout. // Ownership of the socket is not transferred. int bugreportz(int s, bool show_progress); #endif // BUGREPORTZ_H
cmds/bugreportz/main.cpp +11 −3 Original line number Diff line number Diff line Loading @@ -82,7 +82,7 @@ int main(int argc, char* argv[]) { if (s == -1) { printf("FAIL:Failed to connect to dumpstatez service: %s\n", strerror(errno)); return EXIT_SUCCESS; return EXIT_FAILURE; } // Set a timeout so that if nothing is read in 10 minutes, we'll stop Loading @@ -92,8 +92,16 @@ int main(int argc, char* argv[]) { tv.tv_sec = 10 * 60; tv.tv_usec = 0; if (setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) == -1) { fprintf(stderr, "WARNING: Cannot set socket timeout: %s\n", strerror(errno)); fprintf(stderr, "WARNING: Cannot set socket timeout, bugreportz might hang indefinitely: %s\n", strerror(errno)); } bugreportz(s, show_progress); int ret = bugreportz(s, show_progress); if (close(s) == -1) { fprintf(stderr, "WARNING: error closing socket: %s\n", strerror(errno)); ret = EXIT_FAILURE; } return ret; }