return -EIO;
}
- if (lseek(fd, n, SEEK_CUR) == (off_t) -1)
+ if (lseek(fd, n, SEEK_CUR) < 0)
return -errno;
q += n;
if (r < 0)
return r;
- if (lseek(fd_from, 0, SEEK_SET) == (off_t) -1)
+ if (lseek(fd_from, 0, SEEK_SET) < 0)
return log_error_errno(errno, "Failed to seek in \"%s\": %m", from);
fd_to = safe_close(fd_to);
if (r < 0)
return log_unit_error_errno(unit, r, "Failed to serialize parameters: %m");
- if (fseeko(f, 0, SEEK_SET) == (off_t) -1)
+ if (fseeko(f, 0, SEEK_SET) < 0)
return log_unit_error_errno(unit, errno, "Failed to reseek on serialization stream: %m");
r = fd_cloexec(fileno(f), false);
if (r < 0)
return r;
- if (fseeko(f, 0, SEEK_SET) == (off_t) -1)
+ if (fseeko(f, 0, SEEK_SET) < 0)
return log_error_errno(errno, "Failed to rewind serialization fd: %m");
r = fd_cloexec(fileno(f), false);
_cleanup_close_ int fd_compressed = -EBADF;
uint64_t uncompressed_size = 0;
- if (lseek(fd, 0, SEEK_SET) == (off_t) -1)
+ if (lseek(fd, 0, SEEK_SET) < 0)
return log_error_errno(errno, "Failed to seek on coredump %s: %m", fn);
fn_compressed = strjoin(fn, default_compression_extension());
if (fstat(fd, &st) < 0)
return log_error_errno(errno, "Failed to fstat core file %s: %m", coredump_tmpfile_name(tmp));
- if (lseek(fd, 0, SEEK_SET) == (off_t) -1)
+ if (lseek(fd, 0, SEEK_SET) < 0)
return log_error_errno(errno, "Failed to seek on coredump %s: %m", fn);
*ret_filename = TAKE_PTR(fn);
assert(ret);
assert(ret_size);
- if (lseek(fd, 0, SEEK_SET) == (off_t) -1)
+ if (lseek(fd, 0, SEEK_SET) < 0)
return log_warning_errno(errno, "Failed to seek: %m");
field = malloc(9 + size);
return 0;
}
- if (lseek(fd, SEEK_SET, 0) == (off_t) -1)
+ if (lseek(fd, SEEK_SET, 0) < 0)
return log_error_errno(errno, "Failed to seek to beginning of memfd: %m");
f = take_fdopen(&fd, "r");
"Target file is not a regular file or block device");
if (i->offset != UINT64_MAX) {
- if (lseek(i->output_fd, i->offset, SEEK_SET) == (off_t) -1)
+ if (lseek(i->output_fd, i->offset, SEEK_SET) < 0)
return log_error_errno(errno, "Failed to seek to offset: %m");
}
return 0;
p = lseek(i->input_fd, 0, SEEK_CUR);
- if (p == (off_t) -1)
+ if (p < 0)
return log_error_errno(errno, "Failed to read file offset of input file: %m");
/* Let's only try a btrfs reflink, if we are reading from the beginning of the file */
return log_error_errno(errno, "Failed to stat disk file: %m");
if (j->offset != UINT64_MAX) {
- if (lseek(j->disk_fd, j->offset, SEEK_SET) == (off_t) -1)
+ if (lseek(j->disk_fd, j->offset, SEEK_SET) < 0)
return log_error_errno(errno, "Failed to seek on file descriptor: %m");
}
}
assert(i->raw_job->disk_fd >= 0);
assert(i->offset == UINT64_MAX);
- if (lseek(i->raw_job->disk_fd, SEEK_SET, 0) == (off_t) -1)
+ if (lseek(i->raw_job->disk_fd, SEEK_SET, 0) < 0)
return log_error_errno(errno, "Failed to seek to beginning of vendor image: %m");
}
}
sz = ftello(m->tmp);
- if (sz == (off_t) -1) {
+ if (sz < 0) {
log_error_errno(errno, "Failed to retrieve file position: %m");
return MHD_CONTENT_READER_END_WITH_ERROR;
}
}
sz = ftello(m->tmp);
- if (sz == (off_t) -1) {
+ if (sz < 0) {
log_error_errno(errno, "Failed to retrieve file position: %m");
return MHD_CONTENT_READER_END_WITH_ERROR;
}
assert(operation);
assert(operation->extra_fd >= 0);
- if (lseek(operation->extra_fd, 0, SEEK_SET) == (off_t) -1)
+ if (lseek(operation->extra_fd, 0, SEEK_SET) < 0)
return -errno;
f = take_fdopen(&operation->extra_fd, "r");
};
if (!need_path) {
- if (lseek(whole_fd, p->offset, SEEK_SET) == (off_t) -1)
+ if (lseek(whole_fd, p->offset, SEEK_SET) < 0)
return log_error_errno(errno, "Failed to seek to partition offset: %m");
t->whole_fd = whole_fd;
} else if (t->fd >= 0) {
struct stat st;
- if (lseek(whole_fd, p->offset, SEEK_SET) == (off_t) -1)
+ if (lseek(whole_fd, p->offset, SEEK_SET) < 0)
return log_error_errno(errno, "Failed to seek to partition offset: %m");
- if (lseek(t->fd, 0, SEEK_SET) == (off_t) -1)
+ if (lseek(t->fd, 0, SEEK_SET) < 0)
return log_error_errno(errno, "Failed to seek to start of temporary file: %m");
if (fstat(t->fd, &st) < 0)
if (r < 0)
return log_error_errno(r, "Failed to pad string to %s", FORMAT_BYTES(p->new_size));
- if (lseek(whole_fd, p->offset, SEEK_SET) == (off_t) -1)
+ if (lseek(whole_fd, p->offset, SEEK_SET) < 0)
return log_error_errno(errno, "Failed to seek to partition %s offset: %m", strna(hint));
r = loop_write(whole_fd, text, p->new_size);
assert(fd >= 0);
- if (lseek(fd, 0, SEEK_SET) == (off_t) -1)
+ if (lseek(fd, 0, SEEK_SET) < 0)
return log_warning_errno(errno, "Failed to seek to beginning of the core file: %m");
if (ret && !memstream_init(&c.m))
assert(fd >= 0);
- if (lseek(fd, 0, SEEK_SET) == (off_t) -1)
+ if (lseek(fd, 0, SEEK_SET) < 0)
return log_warning_errno(errno, "Failed to seek to beginning of the ELF file: %m");
if (ret && !memstream_init(&c.m))
}
if (writable) {
- if (lseek(fd, 0, SEEK_SET) == (off_t) -1)
+ if (lseek(fd, 0, SEEK_SET) < 0)
return log_error_errno(errno, "Failed to seek %s: %m", etc_machine_id);
if (ftruncate(fd, 0) < 0)
if (r < 0)
return log_debug_errno(r, "Failed to format JSON: %m");
- if (lseek(fd, 0, SEEK_END) == (off_t) -1)
+ if (lseek(fd, 0, SEEK_END) < 0)
return log_debug_errno(errno, "Failed to seek to end of JSON log: %m");
r = loop_write(fd, f, SIZE_MAX);