mirror of
https://github.com/systemd/systemd.git
synced 2024-12-12 03:33:44 +08:00
parent
579fbe5b78
commit
82ee54b2d8
@ -382,7 +382,7 @@ int iovw_append(struct iovec_wrapper *target, const struct iovec_wrapper *source
|
||||
|
||||
/* This duplicates the source and merges it into the target. */
|
||||
|
||||
if (!source || source->count == 0)
|
||||
if (iovw_isempty(source))
|
||||
return 0;
|
||||
|
||||
original_count = target->count;
|
||||
|
@ -101,12 +101,19 @@ void iovw_free_contents(struct iovec_wrapper *iovw, bool free_vectors);
|
||||
int iovw_put(struct iovec_wrapper *iovw, void *data, size_t len);
|
||||
static inline int iovw_consume(struct iovec_wrapper *iovw, void *data, size_t len) {
|
||||
/* Move data into iovw or free on error */
|
||||
int r = iovw_put(iovw, data, len);
|
||||
int r;
|
||||
|
||||
r = iovw_put(iovw, data, len);
|
||||
if (r < 0)
|
||||
free(data);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static inline bool iovw_isempty(const struct iovec_wrapper *iovw) {
|
||||
return !iovw || iovw->count == 0;
|
||||
}
|
||||
|
||||
int iovw_put_string_field(struct iovec_wrapper *iovw, const char *field, const char *value);
|
||||
int iovw_put_string_field_free(struct iovec_wrapper *iovw, const char *field, char *value);
|
||||
void iovw_rebase(struct iovec_wrapper *iovw, char *old, char *new);
|
||||
|
@ -88,8 +88,7 @@ int writer_write(Writer *w,
|
||||
int r;
|
||||
|
||||
assert(w);
|
||||
assert(iovw);
|
||||
assert(iovw->count > 0);
|
||||
assert(!iovw_isempty(iovw));
|
||||
|
||||
if (journal_file_rotate_suggested(w->journal->file, 0, LOG_DEBUG)) {
|
||||
log_info("%s: Journal header limits reached or header out-of-date, rotating",
|
||||
|
Loading…
Reference in New Issue
Block a user