Fixes for Coverity CIDs 702013,702014,702015,702016,702017.
Satisfying Coverity for case of resource leak in case open() returns file descriptor equal to 0.
This commit is contained in:
parent
e8aa6be532
commit
34e730c8fa
@ -29,7 +29,7 @@ void create_log()
|
||||
|
||||
int flags = O_WRONLY | O_CREAT | ((gTruncateLogFile) ? O_TRUNC : 0);
|
||||
int fd = open(gLogFilePath, flags, 0666);
|
||||
if (fd > 0)
|
||||
if (fd >= 0)
|
||||
close(fd);
|
||||
|
||||
mutex_init(&gLogLock, DRIVER_NAME"-logging");
|
||||
@ -108,7 +108,7 @@ void SiS7018_trace(bool force, const char* func, const char *fmt, ...)
|
||||
|
||||
mutex_lock(&gLogLock);
|
||||
int fd = open(gLogFilePath, O_WRONLY | O_APPEND);
|
||||
if (fd > 0) {
|
||||
if (fd >= 0) {
|
||||
write(fd, buffer, strlen(buffer));
|
||||
close(fd);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ void create_log()
|
||||
|
||||
int flags = O_WRONLY | O_CREAT | ((gTruncateLogFile) ? O_TRUNC : 0);
|
||||
int fd = open(gLogFilePath, flags, 0666);
|
||||
if (fd > 0)
|
||||
if (fd >= 0)
|
||||
close(fd);
|
||||
|
||||
mutex_init(&gLogLock, DRIVER_NAME"-logging");
|
||||
@ -122,7 +122,7 @@ void SiS19X_trace(bool force, const char* func, const char *fmt, ...)
|
||||
|
||||
mutex_lock(&gLogLock);
|
||||
int fd = open(gLogFilePath, O_WRONLY | O_APPEND);
|
||||
if (fd > 0) {
|
||||
if (fd >= 0) {
|
||||
write(fd, buffer, strlen(buffer));
|
||||
close(fd);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ void create_log()
|
||||
|
||||
int flags = O_WRONLY | O_CREAT | ((gTruncateLogFile) ? O_TRUNC : 0);
|
||||
int fd = open(gLogFilePath, flags, 0666);
|
||||
if (fd > 0)
|
||||
if (fd >= 0)
|
||||
close(fd);
|
||||
|
||||
mutex_init(&gLogLock, DRIVER_NAME"-logging");
|
||||
@ -117,7 +117,7 @@ void usb_asix_trace(bool force, const char* func, const char *fmt, ...)
|
||||
|
||||
mutex_lock(&gLogLock);
|
||||
int fd = open(gLogFilePath, O_WRONLY | O_APPEND);
|
||||
if (fd > 0) {
|
||||
if (fd >= 0) {
|
||||
write(fd, buffer, strlen(buffer));
|
||||
close(fd);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ void create_log()
|
||||
|
||||
int flags = O_WRONLY | O_CREAT | ((gTruncateLogFile) ? O_TRUNC : 0);
|
||||
int fd = open(gLogFilePath, flags, 0666);
|
||||
if (fd > 0)
|
||||
if (fd >= 0)
|
||||
close(fd);
|
||||
|
||||
mutex_init(&gLogLock, DRIVER_NAME"-logging");
|
||||
@ -124,7 +124,7 @@ void usb_davicom_trace(bool force, const char* func, const char *fmt, ...)
|
||||
|
||||
mutex_lock(&gLogLock);
|
||||
int fd = open(gLogFilePath, O_WRONLY | O_APPEND);
|
||||
if (fd > 0) {
|
||||
if (fd >= 0) {
|
||||
write(fd, buffer, strlen(buffer));
|
||||
close(fd);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user