From d2d9721c4e6ead2edbfab8c8acdbf5a87c2d11a1 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 18 Jan 2022 13:43:56 -0500 Subject: [PATCH] spacing, remove redundant debug --- src/zm_eventstream.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/zm_eventstream.cpp b/src/zm_eventstream.cpp index 54f6b60d8..28a0e50d6 100644 --- a/src/zm_eventstream.cpp +++ b/src/zm_eventstream.cpp @@ -1096,35 +1096,33 @@ void EventStream::runStream() { bool EventStream::send_file(const std::string &filepath) { FILE *fdj = nullptr; fdj = fopen(filepath.c_str(), "rb"); - if ( !fdj ) { + if (!fdj) { Error("Can't open %s: %s", filepath.c_str(), strerror(errno)); std::string error_message = stringtf("Can't open %s: %s", filepath.c_str(), strerror(errno)); return sendTextFrame(error_message.c_str()); } #if HAVE_SENDFILE static struct stat filestat; - if ( fstat(fileno(fdj), &filestat) < 0 ) { + if (fstat(fileno(fdj), &filestat) < 0) { fclose(fdj); /* Close the file handle */ Error("Failed getting information about file %s: %s", filepath.c_str(), strerror(errno)); return false; } - if ( !filestat.st_size ) { + if (!filestat.st_size) { fclose(fdj); /* Close the file handle */ Info("File size is zero. Unable to send raw frame %ld: %s", curr_frame_id, strerror(errno)); return false; } - if ( 0 > fprintf(stdout, "Content-Length: %d\r\n\r\n", (int)filestat.st_size) ) { + if (0 > fprintf(stdout, "Content-Length: %d\r\n\r\n", (int)filestat.st_size)) { fclose(fdj); /* Close the file handle */ Info("Unable to send raw frame %ld: %s", curr_frame_id, strerror(errno)); return false; } int rc = zm_sendfile(fileno(stdout), fileno(fdj), 0, (int)filestat.st_size); - if ( rc == (int)filestat.st_size ) { + if (rc == (int)filestat.st_size) { // Success fclose(fdj); /* Close the file handle */ return true; - } else { - Debug(1, "Failed to sendfile?"); } Warning("Unable to send raw frame %ld: %s rc %d != %d", curr_frame_id, strerror(errno), rc, (int)filestat.st_size);