chiark / gitweb /
core: add RemoveIPC= setting
[elogind.git] / src / shared / conf-parser.c
1 /***
2   This file is part of systemd.
3
4   Copyright 2010 Lennart Poettering
5
6   systemd is free software; you can redistribute it and/or modify it
7   under the terms of the GNU Lesser General Public License as published by
8   the Free Software Foundation; either version 2.1 of the License, or
9   (at your option) any later version.
10
11   systemd is distributed in the hope that it will be useful, but
12   WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14   Lesser General Public License for more details.
15
16   You should have received a copy of the GNU Lesser General Public License
17   along with systemd; If not, see <http://www.gnu.org/licenses/>.
18 ***/
19
20 #include <errno.h>
21 #include <limits.h>
22 #include <stdint.h>
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include <string.h>
26 #include <sys/types.h>
27
28 #include "alloc-util.h"
29 #include "conf-files.h"
30 #include "conf-parser.h"
31 #include "extract-word.h"
32 #include "fd-util.h"
33 #include "fs-util.h"
34 #include "log.h"
35 #include "macro.h"
36 #include "parse-util.h"
37 #include "path-util.h"
38 #include "process-util.h"
39 #include "signal-util.h"
40 #include "string-util.h"
41 #include "strv.h"
42 #include "syslog-util.h"
43 #include "time-util.h"
44 #include "utf8.h"
45
46 int config_item_table_lookup(
47                 const void *table,
48                 const char *section,
49                 const char *lvalue,
50                 ConfigParserCallback *func,
51                 int *ltype,
52                 void **data,
53                 void *userdata) {
54
55         const ConfigTableItem *t;
56
57         assert(table);
58         assert(lvalue);
59         assert(func);
60         assert(ltype);
61         assert(data);
62
63         for (t = table; t->lvalue; t++) {
64
65                 if (!streq(lvalue, t->lvalue))
66                         continue;
67
68                 if (!streq_ptr(section, t->section))
69                         continue;
70
71                 *func = t->parse;
72                 *ltype = t->ltype;
73                 *data = t->data;
74                 return 1;
75         }
76
77         return 0;
78 }
79
80 int config_item_perf_lookup(
81                 const void *table,
82                 const char *section,
83                 const char *lvalue,
84                 ConfigParserCallback *func,
85                 int *ltype,
86                 void **data,
87                 void *userdata) {
88
89         ConfigPerfItemLookup lookup = (ConfigPerfItemLookup) table;
90         const ConfigPerfItem *p;
91
92         assert(table);
93         assert(lvalue);
94         assert(func);
95         assert(ltype);
96         assert(data);
97
98         if (!section)
99                 p = lookup(lvalue, strlen(lvalue));
100         else {
101                 char *key;
102
103                 key = strjoin(section, ".", lvalue, NULL);
104                 if (!key)
105                         return -ENOMEM;
106
107                 p = lookup(key, strlen(key));
108                 free(key);
109         }
110
111         if (!p)
112                 return 0;
113
114         *func = p->parse;
115         *ltype = p->ltype;
116         *data = (uint8_t*) userdata + p->offset;
117         return 1;
118 }
119
120 /* Run the user supplied parser for an assignment */
121 static int next_assignment(const char *unit,
122                            const char *filename,
123                            unsigned line,
124                            ConfigItemLookup lookup,
125                            const void *table,
126                            const char *section,
127                            unsigned section_line,
128                            const char *lvalue,
129                            const char *rvalue,
130                            bool relaxed,
131                            void *userdata) {
132
133         ConfigParserCallback func = NULL;
134         int ltype = 0;
135         void *data = NULL;
136         int r;
137
138         assert(filename);
139         assert(line > 0);
140         assert(lookup);
141         assert(lvalue);
142         assert(rvalue);
143
144         r = lookup(table, section, lvalue, &func, &ltype, &data, userdata);
145         if (r < 0)
146                 return r;
147
148         if (r > 0) {
149                 if (func)
150                         return func(unit, filename, line, section, section_line,
151                                     lvalue, ltype, rvalue, data, userdata);
152
153                 return 0;
154         }
155
156         /* Warn about unknown non-extension fields. */
157         if (!relaxed && !startswith(lvalue, "X-"))
158                 log_syntax(unit, LOG_WARNING, filename, line, 0, "Unknown lvalue '%s' in section '%s'", lvalue, section);
159
160         return 0;
161 }
162
163 /* Parse a variable assignment line */
164 static int parse_line(const char* unit,
165                       const char *filename,
166                       unsigned line,
167                       const char *sections,
168                       ConfigItemLookup lookup,
169                       const void *table,
170                       bool relaxed,
171                       bool allow_include,
172                       char **section,
173                       unsigned *section_line,
174                       bool *section_ignored,
175                       char *l,
176                       void *userdata) {
177
178         char *e;
179
180         assert(filename);
181         assert(line > 0);
182         assert(lookup);
183         assert(l);
184
185         l = strstrip(l);
186
187         if (!*l)
188                 return 0;
189
190         if (strchr(COMMENTS "\n", *l))
191                 return 0;
192
193         if (startswith(l, ".include ")) {
194                 _cleanup_free_ char *fn = NULL;
195
196                 /* .includes are a bad idea, we only support them here
197                  * for historical reasons. They create cyclic include
198                  * problems and make it difficult to detect
199                  * configuration file changes with an easy
200                  * stat(). Better approaches, such as .d/ drop-in
201                  * snippets exist.
202                  *
203                  * Support for them should be eventually removed. */
204
205                 if (!allow_include) {
206                         log_syntax(unit, LOG_ERR, filename, line, 0, ".include not allowed here. Ignoring.");
207                         return 0;
208                 }
209
210                 fn = file_in_same_dir(filename, strstrip(l+9));
211                 if (!fn)
212                         return -ENOMEM;
213
214                 return config_parse(unit, fn, NULL, sections, lookup, table, relaxed, false, false, userdata);
215         }
216
217         if (*l == '[') {
218                 size_t k;
219                 char *n;
220
221                 k = strlen(l);
222                 assert(k > 0);
223
224                 if (l[k-1] != ']') {
225                         log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid section header '%s'", l);
226                         return -EBADMSG;
227                 }
228
229                 n = strndup(l+1, k-2);
230                 if (!n)
231                         return -ENOMEM;
232
233                 if (sections && !nulstr_contains(sections, n)) {
234
235                         if (!relaxed && !startswith(n, "X-"))
236                                 log_syntax(unit, LOG_WARNING, filename, line, 0, "Unknown section '%s'. Ignoring.", n);
237
238                         free(n);
239                         *section = mfree(*section);
240                         *section_line = 0;
241                         *section_ignored = true;
242                 } else {
243                         free(*section);
244                         *section = n;
245                         *section_line = line;
246                         *section_ignored = false;
247                 }
248
249                 return 0;
250         }
251
252         if (sections && !*section) {
253
254                 if (!relaxed && !*section_ignored)
255                         log_syntax(unit, LOG_WARNING, filename, line, 0, "Assignment outside of section. Ignoring.");
256
257                 return 0;
258         }
259
260         e = strchr(l, '=');
261         if (!e) {
262                 log_syntax(unit, LOG_WARNING, filename, line, 0, "Missing '='.");
263                 return -EINVAL;
264         }
265
266         *e = 0;
267         e++;
268
269         return next_assignment(unit,
270                                filename,
271                                line,
272                                lookup,
273                                table,
274                                *section,
275                                *section_line,
276                                strstrip(l),
277                                strstrip(e),
278                                relaxed,
279                                userdata);
280 }
281
282 /* Go through the file and parse each line */
283 int config_parse(const char *unit,
284                  const char *filename,
285                  FILE *f,
286                  const char *sections,
287                  ConfigItemLookup lookup,
288                  const void *table,
289                  bool relaxed,
290                  bool allow_include,
291                  bool warn,
292                  void *userdata) {
293
294         _cleanup_free_ char *section = NULL, *continuation = NULL;
295         _cleanup_fclose_ FILE *ours = NULL;
296         unsigned line = 0, section_line = 0;
297         bool section_ignored = false, allow_bom = true;
298         int r;
299
300         assert(filename);
301         assert(lookup);
302
303         if (!f) {
304                 f = ours = fopen(filename, "re");
305                 if (!f) {
306                         /* Only log on request, except for ENOENT,
307                          * since we return 0 to the caller. */
308                         if (warn || errno == ENOENT)
309                                 log_full(errno == ENOENT ? LOG_DEBUG : LOG_ERR,
310                                          "Failed to open configuration file '%s': %m", filename);
311                         return errno == ENOENT ? 0 : -errno;
312                 }
313         }
314
315         fd_warn_permissions(filename, fileno(f));
316
317         for (;;) {
318                 char buf[LINE_MAX], *l, *p, *c = NULL, *e;
319                 bool escaped = false;
320
321                 if (!fgets(buf, sizeof buf, f)) {
322                         if (feof(f))
323                                 break;
324
325                         return log_error_errno(errno, "Failed to read configuration file '%s': %m", filename);
326                 }
327
328                 l = buf;
329                 if (allow_bom && startswith(l, UTF8_BYTE_ORDER_MARK))
330                         l += strlen(UTF8_BYTE_ORDER_MARK);
331                 allow_bom = false;
332
333                 truncate_nl(l);
334
335                 if (continuation) {
336                         c = strappend(continuation, l);
337                         if (!c) {
338                                 if (warn)
339                                         log_oom();
340                                 return -ENOMEM;
341                         }
342
343                         continuation = mfree(continuation);
344                         p = c;
345                 } else
346                         p = l;
347
348                 for (e = p; *e; e++) {
349                         if (escaped)
350                                 escaped = false;
351                         else if (*e == '\\')
352                                 escaped = true;
353                 }
354
355                 if (escaped) {
356                         *(e-1) = ' ';
357
358                         if (c)
359                                 continuation = c;
360                         else {
361                                 continuation = strdup(l);
362                                 if (!continuation) {
363                                         if (warn)
364                                                 log_oom();
365                                         return -ENOMEM;
366                                 }
367                         }
368
369                         continue;
370                 }
371
372                 r = parse_line(unit,
373                                filename,
374                                ++line,
375                                sections,
376                                lookup,
377                                table,
378                                relaxed,
379                                allow_include,
380                                &section,
381                                &section_line,
382                                &section_ignored,
383                                p,
384                                userdata);
385                 free(c);
386
387                 if (r < 0) {
388                         if (warn)
389                                 log_warning_errno(r, "Failed to parse file '%s': %m",
390                                                   filename);
391                         return r;
392                 }
393         }
394
395         return 0;
396 }
397
398 /* Parse each config file in the specified directories. */
399 int config_parse_many(const char *conf_file,
400                       const char *conf_file_dirs,
401                       const char *sections,
402                       ConfigItemLookup lookup,
403                       const void *table,
404                       bool relaxed,
405                       void *userdata) {
406         _cleanup_strv_free_ char **files = NULL;
407         char **fn;
408         int r;
409
410         r = conf_files_list_nulstr(&files, ".conf", NULL, conf_file_dirs);
411         if (r < 0)
412                 return r;
413
414         if (conf_file) {
415                 r = config_parse(NULL, conf_file, NULL, sections, lookup, table, relaxed, false, true, userdata);
416                 if (r < 0)
417                         return r;
418         }
419
420         STRV_FOREACH(fn, files) {
421                 r = config_parse(NULL, *fn, NULL, sections, lookup, table, relaxed, false, true, userdata);
422                 if (r < 0)
423                         return r;
424         }
425
426         return 0;
427 }
428
429 #define DEFINE_PARSER(type, vartype, conv_func)                         \
430         int config_parse_##type(                                        \
431                         const char *unit,                               \
432                         const char *filename,                           \
433                         unsigned line,                                  \
434                         const char *section,                            \
435                         unsigned section_line,                          \
436                         const char *lvalue,                             \
437                         int ltype,                                      \
438                         const char *rvalue,                             \
439                         void *data,                                     \
440                         void *userdata) {                               \
441                                                                         \
442                 vartype *i = data;                                      \
443                 int r;                                                  \
444                                                                         \
445                 assert(filename);                                       \
446                 assert(lvalue);                                         \
447                 assert(rvalue);                                         \
448                 assert(data);                                           \
449                                                                         \
450                 r = conv_func(rvalue, i);                               \
451                 if (r < 0)                                              \
452                         log_syntax(unit, LOG_ERR, filename, line, r,    \
453                                    "Failed to parse %s value, ignoring: %s", \
454                                    #type, rvalue);                      \
455                                                                         \
456                 return 0;                                               \
457         }                                                               \
458         struct __useless_struct_to_allow_trailing_semicolon__
459
460 DEFINE_PARSER(int, int, safe_atoi);
461 DEFINE_PARSER(long, long, safe_atoli);
462 DEFINE_PARSER(uint32, uint32_t, safe_atou32);
463 DEFINE_PARSER(uint64, uint64_t, safe_atou64);
464 DEFINE_PARSER(unsigned, unsigned, safe_atou);
465 DEFINE_PARSER(double, double, safe_atod);
466 #if 0 /// UNNEEDED by elogind
467 DEFINE_PARSER(nsec, nsec_t, parse_nsec);
468 #endif // 0
469 DEFINE_PARSER(sec, usec_t, parse_sec);
470 DEFINE_PARSER(mode, mode_t, parse_mode);
471
472 int config_parse_iec_size(const char* unit,
473                             const char *filename,
474                             unsigned line,
475                             const char *section,
476                             unsigned section_line,
477                             const char *lvalue,
478                             int ltype,
479                             const char *rvalue,
480                             void *data,
481                             void *userdata) {
482
483         size_t *sz = data;
484         uint64_t v;
485         int r;
486
487         assert(filename);
488         assert(lvalue);
489         assert(rvalue);
490         assert(data);
491
492         r = parse_size(rvalue, 1024, &v);
493         if (r < 0 || (uint64_t) (size_t) v != v) {
494                 log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse size value, ignoring: %s", rvalue);
495                 return 0;
496         }
497
498         *sz = (size_t) v;
499         return 0;
500 }
501
502 #if 0 /// UNNEEDED by elogind
503 int config_parse_si_size(const char* unit,
504                             const char *filename,
505                             unsigned line,
506                             const char *section,
507                             unsigned section_line,
508                             const char *lvalue,
509                             int ltype,
510                             const char *rvalue,
511                             void *data,
512                             void *userdata) {
513
514         size_t *sz = data;
515         uint64_t v;
516         int r;
517
518         assert(filename);
519         assert(lvalue);
520         assert(rvalue);
521         assert(data);
522
523         r = parse_size(rvalue, 1000, &v);
524         if (r < 0 || (uint64_t) (size_t) v != v) {
525                 log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse size value, ignoring: %s", rvalue);
526                 return 0;
527         }
528
529         *sz = (size_t) v;
530         return 0;
531 }
532
533 int config_parse_iec_uint64(const char* unit,
534                            const char *filename,
535                            unsigned line,
536                            const char *section,
537                            unsigned section_line,
538                            const char *lvalue,
539                            int ltype,
540                            const char *rvalue,
541                            void *data,
542                            void *userdata) {
543
544         uint64_t *bytes = data;
545         int r;
546
547         assert(filename);
548         assert(lvalue);
549         assert(rvalue);
550         assert(data);
551
552         r = parse_size(rvalue, 1024, bytes);
553         if (r < 0)
554                 log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse size value, ignoring: %s", rvalue);
555
556         return 0;
557 }
558 #endif // 0
559
560 int config_parse_bool(const char* unit,
561                       const char *filename,
562                       unsigned line,
563                       const char *section,
564                       unsigned section_line,
565                       const char *lvalue,
566                       int ltype,
567                       const char *rvalue,
568                       void *data,
569                       void *userdata) {
570
571         int k;
572         bool *b = data;
573
574         assert(filename);
575         assert(lvalue);
576         assert(rvalue);
577         assert(data);
578
579         k = parse_boolean(rvalue);
580         if (k < 0) {
581                 log_syntax(unit, LOG_ERR, filename, line, k, "Failed to parse boolean value, ignoring: %s", rvalue);
582                 return 0;
583         }
584
585         *b = !!k;
586         return 0;
587 }
588
589 #if 0 /// UNNEEDED by elogind
590 int config_parse_tristate(
591                 const char* unit,
592                 const char *filename,
593                 unsigned line,
594                 const char *section,
595                 unsigned section_line,
596                 const char *lvalue,
597                 int ltype,
598                 const char *rvalue,
599                 void *data,
600                 void *userdata) {
601
602         int k, *t = data;
603
604         assert(filename);
605         assert(lvalue);
606         assert(rvalue);
607         assert(data);
608
609         /* A tristate is pretty much a boolean, except that it can
610          * also take the special value -1, indicating "uninitialized",
611          * much like NULL is for a pointer type. */
612
613         k = parse_boolean(rvalue);
614         if (k < 0) {
615                 log_syntax(unit, LOG_ERR, filename, line, k, "Failed to parse boolean value, ignoring: %s", rvalue);
616                 return 0;
617         }
618
619         *t = !!k;
620         return 0;
621 }
622 #endif // 0
623
624 int config_parse_string(
625                 const char *unit,
626                 const char *filename,
627                 unsigned line,
628                 const char *section,
629                 unsigned section_line,
630                 const char *lvalue,
631                 int ltype,
632                 const char *rvalue,
633                 void *data,
634                 void *userdata) {
635
636         char **s = data, *n;
637
638         assert(filename);
639         assert(lvalue);
640         assert(rvalue);
641         assert(data);
642
643         if (!utf8_is_valid(rvalue)) {
644                 log_syntax_invalid_utf8(unit, LOG_ERR, filename, line, rvalue);
645                 return 0;
646         }
647
648         if (isempty(rvalue))
649                 n = NULL;
650         else {
651                 n = strdup(rvalue);
652                 if (!n)
653                         return log_oom();
654         }
655
656         free(*s);
657         *s = n;
658
659         return 0;
660 }
661
662 int config_parse_path(
663                 const char *unit,
664                 const char *filename,
665                 unsigned line,
666                 const char *section,
667                 unsigned section_line,
668                 const char *lvalue,
669                 int ltype,
670                 const char *rvalue,
671                 void *data,
672                 void *userdata) {
673
674         char **s = data, *n;
675
676         assert(filename);
677         assert(lvalue);
678         assert(rvalue);
679         assert(data);
680
681         if (!utf8_is_valid(rvalue)) {
682                 log_syntax_invalid_utf8(unit, LOG_ERR, filename, line, rvalue);
683                 return 0;
684         }
685
686         if (!path_is_absolute(rvalue)) {
687                 log_syntax(unit, LOG_ERR, filename, line, 0, "Not an absolute path, ignoring: %s", rvalue);
688                 return 0;
689         }
690
691         n = strdup(rvalue);
692         if (!n)
693                 return log_oom();
694
695         path_kill_slashes(n);
696
697         free(*s);
698         *s = n;
699
700         return 0;
701 }
702
703 int config_parse_strv(const char *unit,
704                       const char *filename,
705                       unsigned line,
706                       const char *section,
707                       unsigned section_line,
708                       const char *lvalue,
709                       int ltype,
710                       const char *rvalue,
711                       void *data,
712                       void *userdata) {
713
714         char ***sv = data;
715         int r;
716
717         assert(filename);
718         assert(lvalue);
719         assert(rvalue);
720         assert(data);
721
722         if (isempty(rvalue)) {
723                 char **empty;
724
725                 /* Empty assignment resets the list. As a special rule
726                  * we actually fill in a real empty array here rather
727                  * than NULL, since some code wants to know if
728                  * something was set at all... */
729                 empty = new0(char*, 1);
730                 if (!empty)
731                         return log_oom();
732
733                 strv_free(*sv);
734                 *sv = empty;
735
736                 return 0;
737         }
738
739         for (;;) {
740                 char *word = NULL;
741
742                 r = extract_first_word(&rvalue, &word, WHITESPACE, EXTRACT_QUOTES|EXTRACT_RETAIN_ESCAPE);
743                 if (r == 0)
744                         break;
745                 if (r == -ENOMEM)
746                         return log_oom();
747                 if (r < 0) {
748                         log_syntax(unit, LOG_ERR, filename, line, r, "Invalid syntax, ignoring: %s", rvalue);
749                         break;
750                 }
751
752                 if (!utf8_is_valid(word)) {
753                         log_syntax_invalid_utf8(unit, LOG_ERR, filename, line, rvalue);
754                         free(word);
755                         continue;
756                 }
757                 r = strv_consume(sv, word);
758                 if (r < 0)
759                         return log_oom();
760         }
761
762         return 0;
763 }
764
765 #if 0 /// UNNEEDED by elogind
766 int config_parse_log_facility(
767                 const char *unit,
768                 const char *filename,
769                 unsigned line,
770                 const char *section,
771                 unsigned section_line,
772                 const char *lvalue,
773                 int ltype,
774                 const char *rvalue,
775                 void *data,
776                 void *userdata) {
777
778
779         int *o = data, x;
780
781         assert(filename);
782         assert(lvalue);
783         assert(rvalue);
784         assert(data);
785
786         x = log_facility_unshifted_from_string(rvalue);
787         if (x < 0) {
788                 log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse log facility, ignoring: %s", rvalue);
789                 return 0;
790         }
791
792         *o = (x << 3) | LOG_PRI(*o);
793
794         return 0;
795 }
796 #endif // 0
797
798 int config_parse_log_level(
799                 const char *unit,
800                 const char *filename,
801                 unsigned line,
802                 const char *section,
803                 unsigned section_line,
804                 const char *lvalue,
805                 int ltype,
806                 const char *rvalue,
807                 void *data,
808                 void *userdata) {
809
810
811         int *o = data, x;
812
813         assert(filename);
814         assert(lvalue);
815         assert(rvalue);
816         assert(data);
817
818         x = log_level_from_string(rvalue);
819         if (x < 0) {
820                 log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse log level, ignoring: %s", rvalue);
821                 return 0;
822         }
823
824         *o = (*o & LOG_FACMASK) | x;
825         return 0;
826 }
827
828 int config_parse_signal(
829                 const char *unit,
830                 const char *filename,
831                 unsigned line,
832                 const char *section,
833                 unsigned section_line,
834                 const char *lvalue,
835                 int ltype,
836                 const char *rvalue,
837                 void *data,
838                 void *userdata) {
839
840         int *sig = data, r;
841
842         assert(filename);
843         assert(lvalue);
844         assert(rvalue);
845         assert(sig);
846
847         r = signal_from_string_try_harder(rvalue);
848         if (r <= 0) {
849                 log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse signal name, ignoring: %s", rvalue);
850                 return 0;
851         }
852
853         *sig = r;
854         return 0;
855 }
856
857 #if 0 /// UNNEEDED by elogind
858 int config_parse_personality(
859                 const char *unit,
860                 const char *filename,
861                 unsigned line,
862                 const char *section,
863                 unsigned section_line,
864                 const char *lvalue,
865                 int ltype,
866                 const char *rvalue,
867                 void *data,
868                 void *userdata) {
869
870         unsigned long *personality = data, p;
871
872         assert(filename);
873         assert(lvalue);
874         assert(rvalue);
875         assert(personality);
876
877         p = personality_from_string(rvalue);
878         if (p == PERSONALITY_INVALID) {
879                 log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse personality, ignoring: %s", rvalue);
880                 return 0;
881         }
882
883         *personality = p;
884         return 0;
885 }
886
887 int config_parse_ifname(
888                 const char *unit,
889                 const char *filename,
890                 unsigned line,
891                 const char *section,
892                 unsigned section_line,
893                 const char *lvalue,
894                 int ltype,
895                 const char *rvalue,
896                 void *data,
897                 void *userdata) {
898
899         char **s = data;
900         int r;
901
902         assert(filename);
903         assert(lvalue);
904         assert(rvalue);
905         assert(data);
906
907         if (isempty(rvalue)) {
908                 *s = mfree(*s);
909                 return 0;
910         }
911
912         if (!ifname_valid(rvalue)) {
913                 log_syntax(unit, LOG_ERR, filename, line, 0, "Interface name is not valid or too long, ignoring assignment: %s", rvalue);
914                 return 0;
915         }
916
917         r = free_and_strdup(s, rvalue);
918         if (r < 0)
919                 return log_oom();
920
921         return 0;
922 }
923 #endif // 0