mirror of
https://github.com/djhackersdev/saltytools.git
synced 2026-04-25 07:59:36 -05:00
fix: various portability fixes
This commit is contained in:
parent
263fb12bd9
commit
7b2a9ddb9e
|
|
@ -155,8 +155,8 @@ int ifs_read_file(struct ifs *ifs, const struct prop *dirent, void *bytes,
|
|||
struct iobuf dest;
|
||||
struct const_iobuf stat_buf;
|
||||
uint32_t stat[IFS_STAT_LENGTH_];
|
||||
size_t offset;
|
||||
size_t nbytes;
|
||||
uint32_t offset;
|
||||
uint32_t nbytes;
|
||||
size_t i;
|
||||
int r;
|
||||
|
||||
|
|
@ -190,7 +190,7 @@ int ifs_read_file(struct ifs *ifs, const struct prop *dirent, void *bytes,
|
|||
r = fs_seek_to(ifs->f, offset);
|
||||
|
||||
if (r < 0) {
|
||||
log_write("%s: IFS seek failed (offset=%#lx): %s (%i)",
|
||||
log_write("%s: IFS seek failed (offset=%#x): %s (%i)",
|
||||
prop_get_name(dirent), offset, strerror(-r), r);
|
||||
|
||||
return r;
|
||||
|
|
@ -203,7 +203,7 @@ int ifs_read_file(struct ifs *ifs, const struct prop *dirent, void *bytes,
|
|||
r = fs_read(ifs->f, &dest);
|
||||
|
||||
if (r < 0) {
|
||||
log_write("%s: IFS read failed (nbytes=%#lx): %s (%i)",
|
||||
log_write("%s: IFS read failed (nbytes=%#x): %s (%i)",
|
||||
prop_get_name(dirent), nbytes, strerror(-r), r);
|
||||
|
||||
return r;
|
||||
|
|
|
|||
|
|
@ -427,7 +427,7 @@ static void prop_xml_write_text_s64(struct strbuf *dest,
|
|||
|
||||
assert(r >= 0);
|
||||
|
||||
strbuf_printf(dest, "%li", (int64_t)value);
|
||||
strbuf_printf(dest, "%lli", (long long)value);
|
||||
}
|
||||
|
||||
static void prop_xml_write_text_u8(struct strbuf *dest,
|
||||
|
|
@ -487,7 +487,7 @@ static void prop_xml_write_text_u64(struct strbuf *dest,
|
|||
|
||||
assert(r >= 0);
|
||||
|
||||
strbuf_printf(dest, "%lu", value);
|
||||
strbuf_printf(dest, "%llu", (unsigned long long)value);
|
||||
}
|
||||
|
||||
static void prop_xml_write_text_bin(struct strbuf *dest,
|
||||
|
|
|
|||
14
util/fs.c
14
util/fs.c
|
|
@ -64,8 +64,12 @@ int fs_read(FILE *f, struct iobuf *buf) {
|
|||
if (nread < nbytes) {
|
||||
r = -errno;
|
||||
|
||||
if (r == 0) {
|
||||
if (r != 0) {
|
||||
log_write("Read failed: %s (%i)", strerror(-r), r);
|
||||
} else {
|
||||
r = -ENODATA;
|
||||
log_write("Short read: %llu < %llu", (unsigned long long)nread,
|
||||
(unsigned long long)nbytes);
|
||||
}
|
||||
|
||||
return r;
|
||||
|
|
@ -94,7 +98,9 @@ int fs_write(FILE *f, struct const_iobuf *buf) {
|
|||
if (r != 0) {
|
||||
log_write("Write failed: %s (%i)", strerror(-r), r);
|
||||
} else {
|
||||
log_write("Short write: %zu < %zu", nwrit, nbytes);
|
||||
r = -EINTR; /* I guess..??? */
|
||||
log_write("Short write: %llu < %llu", (unsigned long long)nwrit,
|
||||
(unsigned long long)nbytes);
|
||||
}
|
||||
|
||||
return r;
|
||||
|
|
@ -221,7 +227,11 @@ int fs_mkdir(const char *path) {
|
|||
return r;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
r = mkdir(path);
|
||||
#else
|
||||
r = mkdir(path, 0755);
|
||||
#endif
|
||||
|
||||
if (r != 0) {
|
||||
r = -errno;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user