[misc] fix some Coverity issues

* Also add a Coverity build script and update Bled to latest
This commit is contained in:
Pete Batard 2015-02-13 19:51:30 +00:00
parent 6bf699a3f8
commit a783eeef22
6 changed files with 42 additions and 15 deletions

View file

@ -116,10 +116,10 @@ void FAST_FUNC data_extract_all(archive_handle_t *archive_handle)
/* rpm-style temp file name */
dst_name = xasprintf("%s;%x", dst_name, (int)getpid());
#endif
dst_fd = xopen3(dst_name,
flags,
file_header->mode
);
dst_fd = open(dst_name, flags, file_header->mode);
if (dst_fd < 0) {
bb_perror_msg_and_die("can't open file %s", dst_name);
}
bb_copyfd_exact_size(archive_handle->src_fd, dst_fd, file_header->size);
close(dst_fd);
#ifdef ARCHIVE_REPLACE_VIA_RENAME

View file

@ -173,6 +173,15 @@ static inline pid_t wait(int* status) { *status = 4; return -1; }
extern uint64_t bb_total_rb;
static inline int full_read(int fd, void *buf, size_t count) {
int rb;
if (fd < 0) {
errno = EBADF;
return -1;
}
if (buf == NULL) {
errno = EFAULT;
return -1;
}
if ((bled_cancel_request != NULL) && (*bled_cancel_request != 0)) {
errno = EINTR;
return -1;
@ -198,7 +207,6 @@ static inline struct tm *localtime_r(const time_t *timep, struct tm *result) {
#define xmalloc malloc
#define xzalloc(x) calloc(x, 1)
#define malloc_or_warn malloc
#define xopen3 open
#define mkdir(x, y) _mkdirU(x)
#if defined(_MSC_VER)