Loading fuse_sideload.c +3 −3 Original line number Diff line number Diff line Loading @@ -106,12 +106,12 @@ static void fuse_reply(struct fuse_data* fd, __u64 unique, const void *data, siz vec[0].iov_base = &hdr; vec[0].iov_len = sizeof(hdr); vec[1].iov_base = data; vec[1].iov_base = /* const_cast */(void*)(data); vec[1].iov_len = len; res = writev(fd->ffd, vec, 2); if (res < 0) { printf("*** REPLY FAILED *** %d\n", errno); printf("*** REPLY FAILED *** %s\n", strerror(errno)); } } Loading Loading @@ -430,7 +430,7 @@ int run_fuse_sideload(struct provider_vtab* vtab, void* cookie, char opts[256]; snprintf(opts, sizeof(opts), ("fd=%d,user_id=%d,group_id=%d,max_read=%zu," ("fd=%d,user_id=%d,group_id=%d,max_read=%u," "allow_other,rootmode=040000"), fd.ffd, fd.uid, fd.gid, block_size); Loading mtdutils/mtdutils.c +4 −4 Original line number Diff line number Diff line Loading @@ -313,8 +313,8 @@ static int read_block(const MtdPartition *partition, int fd, char *data) memcpy(&before, &after, sizeof(struct mtd_ecc_stats)); } else if ((mgbb = ioctl(fd, MEMGETBADBLOCK, &pos))) { fprintf(stderr, "mtd: MEMGETBADBLOCK returned %d at 0x%08llx (errno=%d)\n", mgbb, pos, errno); "mtd: MEMGETBADBLOCK returned %d at 0x%08llx: %s\n", mgbb, pos, strerror(errno)); } else { return 0; // Success! } Loading Loading @@ -419,8 +419,8 @@ static int write_block(MtdWriteContext *ctx, const char *data) if (ret != 0 && !(ret == -1 && errno == EOPNOTSUPP)) { add_bad_block_offset(ctx, pos); fprintf(stderr, "mtd: not writing bad block at 0x%08lx (ret %d errno %d)\n", pos, ret, errno); "mtd: not writing bad block at 0x%08lx (ret %d): %s\n", pos, ret, strerror(errno)); pos += partition->erase_size; continue; // Don't try to erase known factory-bad blocks. } Loading updater/blockimg.c +20 −19 Original line number Diff line number Diff line Loading @@ -464,7 +464,7 @@ static void EnumerateStash(const char* dirname, StashCallback callback, void* da if (directory == NULL) { if (errno != ENOENT) { fprintf(stderr, "failed to opendir %s (errno %d)\n", dirname, errno); fprintf(stderr, "opendir \"%s\" failed: %s\n", dirname, strerror(errno)); } return; } Loading Loading @@ -495,7 +495,7 @@ static void EnumerateStash(const char* dirname, StashCallback callback, void* da } if (closedir(directory) == -1) { fprintf(stderr, "failed to closedir %s (errno %d)\n", dirname, errno); fprintf(stderr, "closedir \"%s\" failed: %s\n", dirname, strerror(errno)); } } Loading @@ -508,7 +508,7 @@ static void UpdateFileSize(const char* fn, void* data) { } if (stat(fn, &st) == -1) { fprintf(stderr, "failed to stat %s (errno %d)\n", fn, errno); fprintf(stderr, "stat \"%s\" failed: %s\n", fn, strerror(errno)); return; } Loading @@ -524,7 +524,7 @@ static void DeleteFile(const char* fn, void* data) { fprintf(stderr, "deleting %s\n", fn); if (unlink(fn) == -1 && errno != ENOENT) { fprintf(stderr, "failed to unlink %s (errno %d)\n", fn, errno); fprintf(stderr, "unlink \"%s\" failed: %s\n", fn, strerror(errno)); } } } Loading Loading @@ -553,7 +553,7 @@ static void DeleteStash(const char* base) { if (rmdir(dirname) == -1) { if (errno != ENOENT && errno != ENOTDIR) { fprintf(stderr, "failed to rmdir %s (errno %d)\n", dirname, errno); fprintf(stderr, "rmdir \"%s\" failed: %s\n", dirname, strerror(errno)); } } Loading Loading @@ -587,7 +587,7 @@ static int LoadStash(const char* base, const char* id, int verify, int* blocks, if (res == -1) { if (errno != ENOENT || printnoent) { fprintf(stderr, "failed to stat %s (errno %d)\n", fn, errno); fprintf(stderr, "stat \"%s\" failed: %s\n", fn, strerror(errno)); } goto lsout; } Loading @@ -602,7 +602,7 @@ static int LoadStash(const char* base, const char* id, int verify, int* blocks, fd = TEMP_FAILURE_RETRY(open(fn, O_RDONLY)); if (fd == -1) { fprintf(stderr, "failed to open %s (errno %d)\n", fn, errno); fprintf(stderr, "open \"%s\" failed: %s\n", fn, strerror(errno)); goto lsout; } Loading Loading @@ -663,7 +663,7 @@ static int WriteStash(const char* base, const char* id, int blocks, uint8_t* buf fd = TEMP_FAILURE_RETRY(open(fn, O_WRONLY | O_CREAT | O_TRUNC | O_SYNC, STASH_FILE_MODE)); if (fd == -1) { fprintf(stderr, "failed to create %s (errno %d)\n", fn, errno); fprintf(stderr, "failed to create \"%s\": %s\n", fn, strerror(errno)); goto wsout; } Loading @@ -672,12 +672,12 @@ static int WriteStash(const char* base, const char* id, int blocks, uint8_t* buf } if (fsync(fd) == -1) { fprintf(stderr, "failed to fsync %s (errno %d)\n", fn, errno); fprintf(stderr, "fsync \"%s\" failed: %s\n", fn, strerror(errno)); goto wsout; } if (rename(fn, cn) == -1) { fprintf(stderr, "failed to rename %s to %s (errno %d)\n", fn, cn, errno); fprintf(stderr, "rename(\"%s\", \"%s\") failed: %s\n", fn, cn, strerror(errno)); goto wsout; } Loading Loading @@ -737,14 +737,14 @@ static int CreateStash(State* state, int maxblocks, const char* blockdev, char** res = stat(dirname, &st); if (res == -1 && errno != ENOENT) { ErrorAbort(state, "failed to stat %s (errno %d)\n", dirname, errno); ErrorAbort(state, "stat \"%s\" failed: %s\n", dirname, strerror(errno)); goto csout; } else if (res != 0) { fprintf(stderr, "creating stash %s\n", dirname); res = mkdir(dirname, STASH_DIRECTORY_MODE); if (res != 0) { ErrorAbort(state, "failed to create %s (errno %d)\n", dirname, errno); ErrorAbort(state, "mkdir \"%s\" failed: %s\n", dirname, strerror(errno)); goto csout; } Loading Loading @@ -1408,7 +1408,7 @@ static int PerformCommandErase(CommandParameters* params) { } if (fstat(params->fd, &st) == -1) { fprintf(stderr, "failed to fstat device to erase (errno %d)\n", errno); fprintf(stderr, "failed to fstat device to erase: %s\n", strerror(errno)); goto pceout; } Loading Loading @@ -1437,7 +1437,7 @@ static int PerformCommandErase(CommandParameters* params) { blocks[1] = (tgt->pos[i * 2 + 1] - tgt->pos[i * 2]) * (uint64_t) BLOCKSIZE; if (ioctl(params->fd, BLKDISCARD, &blocks) == -1) { fprintf(stderr, "failed to blkdiscard (errno %d)\n", errno); fprintf(stderr, "BLKDISCARD ioctl failed: %s\n", strerror(errno)); // Continue anyway, nothing we can do } } Loading Loading @@ -1574,7 +1574,7 @@ static Value* PerformBlockImageUpdate(const char* name, State* state, int argc, params.fd = TEMP_FAILURE_RETRY(open(blockdev_filename->data, O_RDWR)); if (params.fd == -1) { fprintf(stderr, "failed to open %s: %s", blockdev_filename->data, strerror(errno)); fprintf(stderr, "open \"%s\" failed: %s\n", blockdev_filename->data, strerror(errno)); goto pbiudone; } Loading @@ -1587,8 +1587,9 @@ static Value* PerformBlockImageUpdate(const char* name, State* state, int argc, pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); if (pthread_create(¶ms.thread, &attr, unzip_new_data, ¶ms.nti) != 0) { fprintf(stderr, "failed to create a thread (errno %d)\n", errno); int error = pthread_create(¶ms.thread, &attr, unzip_new_data, ¶ms.nti); if (error != 0) { fprintf(stderr, "pthread_create failed: %s\n", strerror(error)); goto pbiudone; } } Loading Loading @@ -1719,7 +1720,7 @@ static Value* PerformBlockImageUpdate(const char* name, State* state, int argc, pbiudone: if (params.fd != -1) { if (fsync(params.fd) == -1) { fprintf(stderr, "failed to fsync device (errno %d)\n", errno); fprintf(stderr, "fsync failed: %s\n", strerror(errno)); } TEMP_FAILURE_RETRY(close(params.fd)); } Loading Loading @@ -1875,7 +1876,7 @@ Value* RangeSha1Fn(const char* name, State* state, int argc, Expr* argv[]) { int fd = open(blockdev_filename->data, O_RDWR); if (fd < 0) { ErrorAbort(state, "failed to open %s: %s", blockdev_filename->data, strerror(errno)); ErrorAbort(state, "open \"%s\" failed: %s", blockdev_filename->data, strerror(errno)); goto done; } Loading Loading
fuse_sideload.c +3 −3 Original line number Diff line number Diff line Loading @@ -106,12 +106,12 @@ static void fuse_reply(struct fuse_data* fd, __u64 unique, const void *data, siz vec[0].iov_base = &hdr; vec[0].iov_len = sizeof(hdr); vec[1].iov_base = data; vec[1].iov_base = /* const_cast */(void*)(data); vec[1].iov_len = len; res = writev(fd->ffd, vec, 2); if (res < 0) { printf("*** REPLY FAILED *** %d\n", errno); printf("*** REPLY FAILED *** %s\n", strerror(errno)); } } Loading Loading @@ -430,7 +430,7 @@ int run_fuse_sideload(struct provider_vtab* vtab, void* cookie, char opts[256]; snprintf(opts, sizeof(opts), ("fd=%d,user_id=%d,group_id=%d,max_read=%zu," ("fd=%d,user_id=%d,group_id=%d,max_read=%u," "allow_other,rootmode=040000"), fd.ffd, fd.uid, fd.gid, block_size); Loading
mtdutils/mtdutils.c +4 −4 Original line number Diff line number Diff line Loading @@ -313,8 +313,8 @@ static int read_block(const MtdPartition *partition, int fd, char *data) memcpy(&before, &after, sizeof(struct mtd_ecc_stats)); } else if ((mgbb = ioctl(fd, MEMGETBADBLOCK, &pos))) { fprintf(stderr, "mtd: MEMGETBADBLOCK returned %d at 0x%08llx (errno=%d)\n", mgbb, pos, errno); "mtd: MEMGETBADBLOCK returned %d at 0x%08llx: %s\n", mgbb, pos, strerror(errno)); } else { return 0; // Success! } Loading Loading @@ -419,8 +419,8 @@ static int write_block(MtdWriteContext *ctx, const char *data) if (ret != 0 && !(ret == -1 && errno == EOPNOTSUPP)) { add_bad_block_offset(ctx, pos); fprintf(stderr, "mtd: not writing bad block at 0x%08lx (ret %d errno %d)\n", pos, ret, errno); "mtd: not writing bad block at 0x%08lx (ret %d): %s\n", pos, ret, strerror(errno)); pos += partition->erase_size; continue; // Don't try to erase known factory-bad blocks. } Loading
updater/blockimg.c +20 −19 Original line number Diff line number Diff line Loading @@ -464,7 +464,7 @@ static void EnumerateStash(const char* dirname, StashCallback callback, void* da if (directory == NULL) { if (errno != ENOENT) { fprintf(stderr, "failed to opendir %s (errno %d)\n", dirname, errno); fprintf(stderr, "opendir \"%s\" failed: %s\n", dirname, strerror(errno)); } return; } Loading Loading @@ -495,7 +495,7 @@ static void EnumerateStash(const char* dirname, StashCallback callback, void* da } if (closedir(directory) == -1) { fprintf(stderr, "failed to closedir %s (errno %d)\n", dirname, errno); fprintf(stderr, "closedir \"%s\" failed: %s\n", dirname, strerror(errno)); } } Loading @@ -508,7 +508,7 @@ static void UpdateFileSize(const char* fn, void* data) { } if (stat(fn, &st) == -1) { fprintf(stderr, "failed to stat %s (errno %d)\n", fn, errno); fprintf(stderr, "stat \"%s\" failed: %s\n", fn, strerror(errno)); return; } Loading @@ -524,7 +524,7 @@ static void DeleteFile(const char* fn, void* data) { fprintf(stderr, "deleting %s\n", fn); if (unlink(fn) == -1 && errno != ENOENT) { fprintf(stderr, "failed to unlink %s (errno %d)\n", fn, errno); fprintf(stderr, "unlink \"%s\" failed: %s\n", fn, strerror(errno)); } } } Loading Loading @@ -553,7 +553,7 @@ static void DeleteStash(const char* base) { if (rmdir(dirname) == -1) { if (errno != ENOENT && errno != ENOTDIR) { fprintf(stderr, "failed to rmdir %s (errno %d)\n", dirname, errno); fprintf(stderr, "rmdir \"%s\" failed: %s\n", dirname, strerror(errno)); } } Loading Loading @@ -587,7 +587,7 @@ static int LoadStash(const char* base, const char* id, int verify, int* blocks, if (res == -1) { if (errno != ENOENT || printnoent) { fprintf(stderr, "failed to stat %s (errno %d)\n", fn, errno); fprintf(stderr, "stat \"%s\" failed: %s\n", fn, strerror(errno)); } goto lsout; } Loading @@ -602,7 +602,7 @@ static int LoadStash(const char* base, const char* id, int verify, int* blocks, fd = TEMP_FAILURE_RETRY(open(fn, O_RDONLY)); if (fd == -1) { fprintf(stderr, "failed to open %s (errno %d)\n", fn, errno); fprintf(stderr, "open \"%s\" failed: %s\n", fn, strerror(errno)); goto lsout; } Loading Loading @@ -663,7 +663,7 @@ static int WriteStash(const char* base, const char* id, int blocks, uint8_t* buf fd = TEMP_FAILURE_RETRY(open(fn, O_WRONLY | O_CREAT | O_TRUNC | O_SYNC, STASH_FILE_MODE)); if (fd == -1) { fprintf(stderr, "failed to create %s (errno %d)\n", fn, errno); fprintf(stderr, "failed to create \"%s\": %s\n", fn, strerror(errno)); goto wsout; } Loading @@ -672,12 +672,12 @@ static int WriteStash(const char* base, const char* id, int blocks, uint8_t* buf } if (fsync(fd) == -1) { fprintf(stderr, "failed to fsync %s (errno %d)\n", fn, errno); fprintf(stderr, "fsync \"%s\" failed: %s\n", fn, strerror(errno)); goto wsout; } if (rename(fn, cn) == -1) { fprintf(stderr, "failed to rename %s to %s (errno %d)\n", fn, cn, errno); fprintf(stderr, "rename(\"%s\", \"%s\") failed: %s\n", fn, cn, strerror(errno)); goto wsout; } Loading Loading @@ -737,14 +737,14 @@ static int CreateStash(State* state, int maxblocks, const char* blockdev, char** res = stat(dirname, &st); if (res == -1 && errno != ENOENT) { ErrorAbort(state, "failed to stat %s (errno %d)\n", dirname, errno); ErrorAbort(state, "stat \"%s\" failed: %s\n", dirname, strerror(errno)); goto csout; } else if (res != 0) { fprintf(stderr, "creating stash %s\n", dirname); res = mkdir(dirname, STASH_DIRECTORY_MODE); if (res != 0) { ErrorAbort(state, "failed to create %s (errno %d)\n", dirname, errno); ErrorAbort(state, "mkdir \"%s\" failed: %s\n", dirname, strerror(errno)); goto csout; } Loading Loading @@ -1408,7 +1408,7 @@ static int PerformCommandErase(CommandParameters* params) { } if (fstat(params->fd, &st) == -1) { fprintf(stderr, "failed to fstat device to erase (errno %d)\n", errno); fprintf(stderr, "failed to fstat device to erase: %s\n", strerror(errno)); goto pceout; } Loading Loading @@ -1437,7 +1437,7 @@ static int PerformCommandErase(CommandParameters* params) { blocks[1] = (tgt->pos[i * 2 + 1] - tgt->pos[i * 2]) * (uint64_t) BLOCKSIZE; if (ioctl(params->fd, BLKDISCARD, &blocks) == -1) { fprintf(stderr, "failed to blkdiscard (errno %d)\n", errno); fprintf(stderr, "BLKDISCARD ioctl failed: %s\n", strerror(errno)); // Continue anyway, nothing we can do } } Loading Loading @@ -1574,7 +1574,7 @@ static Value* PerformBlockImageUpdate(const char* name, State* state, int argc, params.fd = TEMP_FAILURE_RETRY(open(blockdev_filename->data, O_RDWR)); if (params.fd == -1) { fprintf(stderr, "failed to open %s: %s", blockdev_filename->data, strerror(errno)); fprintf(stderr, "open \"%s\" failed: %s\n", blockdev_filename->data, strerror(errno)); goto pbiudone; } Loading @@ -1587,8 +1587,9 @@ static Value* PerformBlockImageUpdate(const char* name, State* state, int argc, pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); if (pthread_create(¶ms.thread, &attr, unzip_new_data, ¶ms.nti) != 0) { fprintf(stderr, "failed to create a thread (errno %d)\n", errno); int error = pthread_create(¶ms.thread, &attr, unzip_new_data, ¶ms.nti); if (error != 0) { fprintf(stderr, "pthread_create failed: %s\n", strerror(error)); goto pbiudone; } } Loading Loading @@ -1719,7 +1720,7 @@ static Value* PerformBlockImageUpdate(const char* name, State* state, int argc, pbiudone: if (params.fd != -1) { if (fsync(params.fd) == -1) { fprintf(stderr, "failed to fsync device (errno %d)\n", errno); fprintf(stderr, "fsync failed: %s\n", strerror(errno)); } TEMP_FAILURE_RETRY(close(params.fd)); } Loading Loading @@ -1875,7 +1876,7 @@ Value* RangeSha1Fn(const char* name, State* state, int argc, Expr* argv[]) { int fd = open(blockdev_filename->data, O_RDWR); if (fd < 0) { ErrorAbort(state, "failed to open %s: %s", blockdev_filename->data, strerror(errno)); ErrorAbort(state, "open \"%s\" failed: %s", blockdev_filename->data, strerror(errno)); goto done; } Loading