1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-27 03:21:32 +03:00

string-util: make free_and_strdup_warn() return 1 when new string is assigned

This commit is contained in:
Yu Watanabe 2022-10-18 20:08:39 +09:00
parent 5905bddce2
commit a56dd1580d

View File

@ -171,9 +171,12 @@ int split_pair(const char *s, const char *sep, char **l, char **r);
int free_and_strdup(char **p, const char *s);
static inline int free_and_strdup_warn(char **p, const char *s) {
if (free_and_strdup(p, s) < 0)
int r;
r = free_and_strdup(p, s);
if (r < 0)
return log_oom();
return 0;
return r;
}
int free_and_strndup(char **p, const char *s, size_t l);