Loading cmds/bugreportz/bugreportz.cpp +9 −8 Original line number Original line Diff line number Diff line Loading @@ -80,8 +80,8 @@ int main(int argc, char *argv[]) { } } if (s == -1) { if (s == -1) { printf("Failed to connect to dumpstatez service: %s\n", strerror(errno)); printf("FAIL:Failed to connect to dumpstatez service: %s\n", strerror(errno)); return EXIT_FAILURE; return EXIT_SUCCESS; } } // Set a timeout so that if nothing is read in 10 minutes, we'll stop // Set a timeout so that if nothing is read in 10 minutes, we'll stop Loading @@ -91,7 +91,7 @@ int main(int argc, char *argv[]) { tv.tv_sec = 10 * 60; tv.tv_sec = 10 * 60; tv.tv_usec = 0; tv.tv_usec = 0; if (setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) == -1) { if (setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) == -1) { printf("WARNING: Cannot set socket timeout: %s\n", strerror(errno)); fprintf(stderr, "WARNING: Cannot set socket timeout: %s\n", strerror(errno)); } } while (1) { while (1) { Loading @@ -105,8 +105,7 @@ int main(int argc, char *argv[]) { if (errno == EAGAIN) { if (errno == EAGAIN) { errno = ETIMEDOUT; errno = ETIMEDOUT; } } printf("\nBugreport read terminated abnormally (%s).\n", printf("FAIL:Bugreport read terminated abnormally (%s)\n", strerror(errno)); strerror(errno)); break; break; } } Loading @@ -117,15 +116,17 @@ int main(int argc, char *argv[]) { write(STDOUT_FILENO, buffer + bytes_read - bytes_to_send, write(STDOUT_FILENO, buffer + bytes_read - bytes_to_send, bytes_to_send)); bytes_to_send)); if (bytes_written == -1) { if (bytes_written == -1) { printf( fprintf(stderr, "Failed to write data to stdout: read %zd, trying to send %zd (%s)\n", "Failed to write data to stdout: read %zd, trying to send %zd (%s)\n", bytes_read, bytes_to_send, strerror(errno)); bytes_read, bytes_to_send, strerror(errno)); return EXIT_FAILURE; break; } } bytes_to_send -= bytes_written; bytes_to_send -= bytes_written; } while (bytes_written != 0 && bytes_to_send > 0); } while (bytes_written != 0 && bytes_to_send > 0); } } close(s); if (close(s) == -1) { fprintf(stderr, "WARNING: error closing socket: %s\n", strerror(errno)); } return EXIT_SUCCESS; return EXIT_SUCCESS; } } Loading
cmds/bugreportz/bugreportz.cpp +9 −8 Original line number Original line Diff line number Diff line Loading @@ -80,8 +80,8 @@ int main(int argc, char *argv[]) { } } if (s == -1) { if (s == -1) { printf("Failed to connect to dumpstatez service: %s\n", strerror(errno)); printf("FAIL:Failed to connect to dumpstatez service: %s\n", strerror(errno)); return EXIT_FAILURE; return EXIT_SUCCESS; } } // Set a timeout so that if nothing is read in 10 minutes, we'll stop // Set a timeout so that if nothing is read in 10 minutes, we'll stop Loading @@ -91,7 +91,7 @@ int main(int argc, char *argv[]) { tv.tv_sec = 10 * 60; tv.tv_sec = 10 * 60; tv.tv_usec = 0; tv.tv_usec = 0; if (setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) == -1) { if (setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) == -1) { printf("WARNING: Cannot set socket timeout: %s\n", strerror(errno)); fprintf(stderr, "WARNING: Cannot set socket timeout: %s\n", strerror(errno)); } } while (1) { while (1) { Loading @@ -105,8 +105,7 @@ int main(int argc, char *argv[]) { if (errno == EAGAIN) { if (errno == EAGAIN) { errno = ETIMEDOUT; errno = ETIMEDOUT; } } printf("\nBugreport read terminated abnormally (%s).\n", printf("FAIL:Bugreport read terminated abnormally (%s)\n", strerror(errno)); strerror(errno)); break; break; } } Loading @@ -117,15 +116,17 @@ int main(int argc, char *argv[]) { write(STDOUT_FILENO, buffer + bytes_read - bytes_to_send, write(STDOUT_FILENO, buffer + bytes_read - bytes_to_send, bytes_to_send)); bytes_to_send)); if (bytes_written == -1) { if (bytes_written == -1) { printf( fprintf(stderr, "Failed to write data to stdout: read %zd, trying to send %zd (%s)\n", "Failed to write data to stdout: read %zd, trying to send %zd (%s)\n", bytes_read, bytes_to_send, strerror(errno)); bytes_read, bytes_to_send, strerror(errno)); return EXIT_FAILURE; break; } } bytes_to_send -= bytes_written; bytes_to_send -= bytes_written; } while (bytes_written != 0 && bytes_to_send > 0); } while (bytes_written != 0 && bytes_to_send > 0); } } close(s); if (close(s) == -1) { fprintf(stderr, "WARNING: error closing socket: %s\n", strerror(errno)); } return EXIT_SUCCESS; return EXIT_SUCCESS; } }