• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

systemd / systemd / 16130628215

08 Jul 2025 12:05AM UTC coverage: 72.172% (+0.07%) from 72.1%
16130628215

push

github

yuwata
man: also use title case in systemd.service(5)

Follow-up for: 172dd81e9

301188 of 417317 relevant lines covered (72.17%)

716235.63 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.04
/src/basic/env-file.c
1
/* SPDX-License-Identifier: LGPL-2.1-or-later */
2

3
#include <sys/stat.h>
4
#include <unistd.h>
5

6
#include "alloc-util.h"
7
#include "env-file.h"
8
#include "env-util.h"
9
#include "errno-util.h"
10
#include "escape.h"
11
#include "fd-util.h"
12
#include "fileio.h"
13
#include "fs-util.h"
14
#include "label.h"
15
#include "log.h"
16
#include "string-util.h"
17
#include "strv.h"
18
#include "tmpfile-util.h"
19
#include "utf8.h"
20

21
typedef int (*push_env_func_t)(
22
                const char *filename,
23
                unsigned line,
24
                const char *key,
25
                char *value,
26
                void *userdata);
27

28
static int parse_env_file_internal(
204,025✔
29
                FILE *f,
30
                const char *fname,
31
                push_env_func_t push,
32
                void *userdata) {
33

34
        size_t n_key = 0, n_value = 0, last_value_whitespace = SIZE_MAX, last_key_whitespace = SIZE_MAX;
204,025✔
35
        _cleanup_free_ char *contents = NULL, *key = NULL, *value = NULL;
204,025✔
36
        unsigned line = 1;
204,025✔
37
        int r;
204,025✔
38

39
        enum {
204,025✔
40
                PRE_KEY,
41
                KEY,
42
                PRE_VALUE,
43
                VALUE,
44
                VALUE_ESCAPE,
45
                SINGLE_QUOTE_VALUE,
46
                DOUBLE_QUOTE_VALUE,
47
                DOUBLE_QUOTE_VALUE_ESCAPE,
48
                COMMENT,
49
                COMMENT_ESCAPE
50
        } state = PRE_KEY;
204,025✔
51

52
        assert(f || fname);
204,025✔
53
        assert(push);
204,025✔
54

55
        if (f)
204,025✔
56
                r = read_full_stream(f, &contents, NULL);
9,313✔
57
        else
58
                r = read_full_file(fname, &contents, NULL);
194,712✔
59
        if (r < 0)
204,025✔
60
                return r;
61

62
        for (char *p = contents; *p; p++) {
69,995,234✔
63
                char c = *p;
69,797,529✔
64

65
                switch (state) {
69,797,529✔
66

67
                case PRE_KEY:
2,884,664✔
68
                        if (strchr(COMMENTS, c))
2,884,664✔
69
                                state = COMMENT;
70
                        else if (!strchr(WHITESPACE, c)) {
2,694,657✔
71
                                state = KEY;
2,689,371✔
72
                                last_key_whitespace = SIZE_MAX;
2,689,371✔
73

74
                                if (!GREEDY_REALLOC(key, n_key+2))
2,689,371✔
75
                                        return -ENOMEM;
76

77
                                key[n_key++] = c;
2,689,371✔
78
                        }
79
                        break;
80

81
                case KEY:
35,394,044✔
82
                        if (strchr(NEWLINE, c)) {
35,394,044✔
83
                                state = PRE_KEY;
25✔
84
                                line++;
25✔
85
                                n_key = 0;
25✔
86
                        } else if (c == '=') {
35,394,019✔
87
                                state = PRE_VALUE;
88
                                last_value_whitespace = SIZE_MAX;
89
                        } else {
90
                                if (!strchr(WHITESPACE, c))
32,704,673✔
91
                                        last_key_whitespace = SIZE_MAX;
92
                                else if (last_key_whitespace == SIZE_MAX)
86✔
93
                                         last_key_whitespace = n_key;
40✔
94

95
                                if (!GREEDY_REALLOC(key, n_key+2))
32,704,673✔
96
                                        return -ENOMEM;
97

98
                                key[n_key++] = c;
32,704,673✔
99
                        }
100

101
                        break;
102

103
                case PRE_VALUE:
2,903,085✔
104
                        if (strchr(NEWLINE, c)) {
2,903,085✔
105
                                state = PRE_KEY;
674,427✔
106
                                line++;
674,427✔
107
                                key[n_key] = 0;
674,427✔
108

109
                                if (value)
674,427✔
110
                                        value[n_value] = 0;
40,494✔
111

112
                                /* strip trailing whitespace from key */
113
                                if (last_key_whitespace != SIZE_MAX)
674,427✔
114
                                        key[last_key_whitespace] = 0;
6✔
115

116
                                r = push(fname, line, key, value, userdata);
674,427✔
117
                                if (r < 0)
674,427✔
118
                                        return r;
119

120
                                n_key = 0;
674,427✔
121
                                value = NULL;
674,427✔
122
                                n_value = 0;
674,427✔
123

124
                        } else if (c == '\'')
2,228,658✔
125
                                state = SINGLE_QUOTE_VALUE;
126
                        else if (c == '"')
2,228,648✔
127
                                state = DOUBLE_QUOTE_VALUE;
128
                        else if (c == '\\')
2,014,965✔
129
                                state = VALUE_ESCAPE;
130
                        else if (!strchr(WHITESPACE, c)) {
2,014,961✔
131
                                state = VALUE;
2,014,909✔
132

133
                                if (!GREEDY_REALLOC(value, n_value+2))
2,014,909✔
134
                                        return -ENOMEM;
135

136
                                value[n_value++] = c;
2,014,909✔
137
                        }
138

139
                        break;
140

141
                case VALUE:
19,147,612✔
142
                        if (strchr(NEWLINE, c)) {
19,147,612✔
143
                                state = PRE_KEY;
2,014,892✔
144
                                line++;
2,014,892✔
145

146
                                key[n_key] = 0;
2,014,892✔
147

148
                                if (value)
2,014,892✔
149
                                        value[n_value] = 0;
2,014,892✔
150

151
                                /* Chomp off trailing whitespace from value */
152
                                if (last_value_whitespace != SIZE_MAX)
2,014,892✔
153
                                        value[last_value_whitespace] = 0;
16✔
154

155
                                /* strip trailing whitespace from key */
156
                                if (last_key_whitespace != SIZE_MAX)
2,014,892✔
157
                                        key[last_key_whitespace] = 0;
6✔
158

159
                                r = push(fname, line, key, value, userdata);
2,014,892✔
160
                                if (r < 0)
2,014,892✔
161
                                        return r;
162

163
                                n_key = 0;
2,014,892✔
164
                                value = NULL;
2,014,892✔
165
                                n_value = 0;
2,014,892✔
166

167
                        } else if (c == '\\') {
17,132,720✔
168
                                state = VALUE_ESCAPE;
169
                                last_value_whitespace = SIZE_MAX;
170
                        } else {
171
                                if (!strchr(WHITESPACE, c))
17,132,698✔
172
                                        last_value_whitespace = SIZE_MAX;
173
                                else if (last_value_whitespace == SIZE_MAX)
16,002✔
174
                                        last_value_whitespace = n_value;
15,960✔
175

176
                                if (!GREEDY_REALLOC(value, n_value+2))
17,132,698✔
177
                                        return -ENOMEM;
178

179
                                value[n_value++] = c;
17,132,698✔
180
                        }
181

182
                        break;
183

184
                case VALUE_ESCAPE:
25✔
185
                        state = VALUE;
25✔
186

187
                        if (!strchr(NEWLINE, c)) {
25✔
188
                                /* Escaped newlines we eat up entirely */
189
                                if (!GREEDY_REALLOC(value, n_value+2))
16✔
190
                                        return -ENOMEM;
191

192
                                value[n_value++] = c;
16✔
193
                        }
194
                        break;
195

196
                case SINGLE_QUOTE_VALUE:
98✔
197
                        if (c == '\'')
98✔
198
                                state = PRE_VALUE;
199
                        else {
200
                                if (!GREEDY_REALLOC(value, n_value+2))
88✔
201
                                        return -ENOMEM;
202

203
                                value[n_value++] = c;
88✔
204
                        }
205

206
                        break;
207

208
                case DOUBLE_QUOTE_VALUE:
2,421,466✔
209
                        if (c == '"')
2,421,466✔
210
                                state = PRE_VALUE;
211
                        else if (c == '\\')
2,207,783✔
212
                                state = DOUBLE_QUOTE_VALUE_ESCAPE;
213
                        else {
214
                                if (!GREEDY_REALLOC(value, n_value+2))
2,207,751✔
215
                                        return -ENOMEM;
216

217
                                value[n_value++] = c;
2,207,751✔
218
                        }
219

220
                        break;
221

222
                case DOUBLE_QUOTE_VALUE_ESCAPE:
32✔
223
                        state = DOUBLE_QUOTE_VALUE;
32✔
224

225
                        if (strchr(SHELL_NEED_ESCAPE, c)) {
32✔
226
                                /* If this is a char that needs escaping, just unescape it. */
227
                                if (!GREEDY_REALLOC(value, n_value+2))
24✔
228
                                        return -ENOMEM;
229
                                value[n_value++] = c;
24✔
230
                        } else if (c != '\n') {
8✔
231
                                /* If other char than what needs escaping, keep the "\" in place, like the
232
                                 * real shell does. */
233
                                if (!GREEDY_REALLOC(value, n_value+3))
4✔
234
                                        return -ENOMEM;
235
                                value[n_value++] = '\\';
4✔
236
                                value[n_value++] = c;
4✔
237
                        }
238

239
                        /* Escaped newlines (aka "continuation lines") are eaten up entirely */
240
                        break;
241

242
                case COMMENT:
7,046,500✔
243
                        if (c == '\\')
7,046,500✔
244
                                state = COMMENT_ESCAPE;
245
                        else if (strchr(NEWLINE, c)) {
7,046,497✔
246
                                state = PRE_KEY;
190,004✔
247
                                line++;
190,004✔
248
                        }
249
                        break;
250

251
                case COMMENT_ESCAPE:
252
                        log_debug("The line which doesn't begin with \";\" or \"#\", but follows a comment" \
3✔
253
                                  " line trailing with escape is now treated as a non comment line since v254.");
254
                        if (strchr(NEWLINE, c)) {
3✔
255
                                state = PRE_KEY;
3✔
256
                                line++;
3✔
257
                        } else
258
                                state = COMMENT;
259
                        break;
260
                }
261
        }
262

263
        if (IN_SET(state,
197,705✔
264
                   PRE_VALUE,
265
                   VALUE,
266
                   VALUE_ESCAPE,
267
                   SINGLE_QUOTE_VALUE,
268
                   DOUBLE_QUOTE_VALUE,
269
                   DOUBLE_QUOTE_VALUE_ESCAPE)) {
270

271
                key[n_key] = 0;
27✔
272

273
                if (value)
27✔
274
                        value[n_value] = 0;
26✔
275

276
                if (state == VALUE)
27✔
277
                        if (last_value_whitespace != SIZE_MAX)
20✔
278
                                value[last_value_whitespace] = 0;
×
279

280
                /* strip trailing whitespace from key */
281
                if (last_key_whitespace != SIZE_MAX)
27✔
282
                        key[last_key_whitespace] = 0;
×
283

284
                r = push(fname, line, key, value, userdata);
27✔
285
                if (r < 0)
27✔
286
                        return r;
287

288
                value = NULL;
24✔
289
        }
290

291
        return 0;
292
}
293

294
static int check_utf8ness_and_warn(
2,689,333✔
295
                const char *filename, unsigned line,
296
                const char *key, char *value) {
297

298
        assert(key);
2,689,333✔
299

300
        if (!utf8_is_valid(key)) {
2,689,333✔
301
                _cleanup_free_ char *p = NULL;
1✔
302

303
                p = utf8_escape_invalid(key);
1✔
304
                return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
1✔
305
                                       "%s:%u: invalid UTF-8 in key '%s', ignoring.",
306
                                       strna(filename), line, p);
307
        }
308

309
        if (value && !utf8_is_valid(value)) {
4,744,740✔
310
                _cleanup_free_ char *p = NULL;
2✔
311

312
                p = utf8_escape_invalid(value);
2✔
313
                return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
2✔
314
                                       "%s:%u: invalid UTF-8 value for key %s: '%s', ignoring.",
315
                                       strna(filename), line, key, p);
316
        }
317

318
        return 0;
319
}
320

321
static int parse_env_file_push(
2,650,652✔
322
                const char *filename, unsigned line,
323
                const char *key, char *value,
324
                void *userdata) {
325

326
        const char *k;
2,650,652✔
327
        va_list aq, *ap = userdata;
2,650,652✔
328
        int r;
2,650,652✔
329

330
        assert(key);
2,650,652✔
331

332
        r = check_utf8ness_and_warn(filename, line, key, value);
2,650,652✔
333
        if (r < 0)
2,650,652✔
334
                return r;
2,650,652✔
335

336
        va_copy(aq, *ap);
2,650,652✔
337

338
        while ((k = va_arg(aq, const char *))) {
5,261,459✔
339
                char **v;
2,743,775✔
340

341
                v = va_arg(aq, char **);
2,743,775✔
342

343
                if (streq(key, k)) {
2,743,775✔
344
                        va_end(aq);
132,968✔
345
                        free_and_replace(*v, value);
132,968✔
346

347
                        return 1;
132,968✔
348
                }
349
        }
350

351
        va_end(aq);
2,517,684✔
352
        free(value);
2,517,684✔
353

354
        return 0;
2,517,684✔
355
}
356

357
int parse_env_filev(
194,313✔
358
                FILE *f,
359
                const char *fname,
360
                va_list ap) {
361

362
        int r;
194,313✔
363
        va_list aq;
194,313✔
364

365
        assert(f || fname);
194,313✔
366

367
        va_copy(aq, ap);
194,313✔
368
        r = parse_env_file_internal(f, fname, parse_env_file_push, &aq);
194,313✔
369
        va_end(aq);
194,313✔
370
        return r;
194,313✔
371
}
372

373
int parse_env_file_fdv(int fd, const char *fname, va_list ap) {
2,266✔
374
        _cleanup_fclose_ FILE *f = NULL;
2,266✔
375
        va_list aq;
2,266✔
376
        int r;
2,266✔
377

378
        assert(fd >= 0);
2,266✔
379

380
        r = fdopen_independent(fd, "re", &f);
2,266✔
381
        if (r < 0)
2,266✔
382
                return r;
383

384
        va_copy(aq, ap);
2,266✔
385
        r = parse_env_file_internal(f, fname, parse_env_file_push, &aq);
2,266✔
386
        va_end(aq);
2,266✔
387
        return r;
2,266✔
388
}
389

390
int parse_env_file_sentinel(
194,313✔
391
                FILE *f,
392
                const char *fname,
393
                ...) {
394

395
        va_list ap;
194,313✔
396
        int r;
194,313✔
397

398
        assert(f || fname);
194,313✔
399

400
        va_start(ap, fname);
194,313✔
401
        r = parse_env_filev(f, fname, ap);
194,313✔
402
        va_end(ap);
194,313✔
403

404
        return r;
194,313✔
405
}
406

407
int parse_env_file_fd_sentinel(
1,964✔
408
                int fd,
409
                const char *fname, /* only used for logging */
410
                ...) {
411

412
        va_list ap;
1,964✔
413
        int r;
1,964✔
414

415
        assert(fd >= 0);
1,964✔
416

417
        va_start(ap, fname);
1,964✔
418
        r = parse_env_file_fdv(fd, fname, ap);
1,964✔
419
        va_end(ap);
1,964✔
420

421
        return r;
1,964✔
422
}
423

424
static int load_env_file_push(
559✔
425
                const char *filename, unsigned line,
426
                const char *key, char *value,
427
                void *userdata) {
428

429
        char ***m = userdata;
559✔
430
        char *p;
559✔
431
        int r;
559✔
432

433
        assert(key);
559✔
434

435
        r = check_utf8ness_and_warn(filename, line, key, value);
559✔
436
        if (r < 0)
559✔
437
                return r;
438

439
        p = strjoin(key, "=", value);
556✔
440
        if (!p)
556✔
441
                return -ENOMEM;
442

443
        r = strv_env_replace_consume(m, p);
556✔
444
        if (r < 0)
556✔
445
                return r;
446

447
        free(value);
556✔
448
        return 0;
556✔
449
}
450

451
int load_env_file(FILE *f, const char *fname, char ***ret) {
281✔
452
        _cleanup_strv_free_ char **m = NULL;
281✔
453
        int r;
281✔
454

455
        assert(f || fname);
281✔
456
        assert(ret);
281✔
457

458
        r = parse_env_file_internal(f, fname, load_env_file_push, &m);
281✔
459
        if (r < 0)
281✔
460
                return r;
461

462
        *ret = TAKE_PTR(m);
276✔
463
        return 0;
276✔
464
}
465

466
static int load_env_file_push_pairs(
38,122✔
467
                const char *filename, unsigned line,
468
                const char *key, char *value,
469
                void *userdata) {
470

471
        char ***m = ASSERT_PTR(userdata);
38,122✔
472
        int r;
38,122✔
473

474
        assert(key);
38,122✔
475

476
        r = check_utf8ness_and_warn(filename, line, key, value);
38,122✔
477
        if (r < 0)
38,122✔
478
                return r;
479

480
        /* Check if the key is present */
481
        for (char **t = *m; t && *t; t += 2)
207,335✔
482
                if (streq(t[0], key)) {
169,218✔
483
                        if (value)
5✔
484
                                return free_and_replace(t[1], value);
5✔
485
                        else
486
                                return free_and_strdup(t+1, "");
×
487
                }
488

489
        r = strv_extend(m, key);
38,117✔
490
        if (r < 0)
38,117✔
491
                return r;
492

493
        if (value)
38,117✔
494
                return strv_push(m, value);
38,114✔
495
        else
496
                return strv_extend(m, "");
3✔
497
}
498

499
int load_env_file_pairs(FILE *f, const char *fname, char ***ret) {
6,979✔
500
        _cleanup_strv_free_ char **m = NULL;
6,979✔
501
        int r;
6,979✔
502

503
        assert(f || fname);
6,979✔
504
        assert(ret);
6,979✔
505

506
        r = parse_env_file_internal(f, fname, load_env_file_push_pairs, &m);
6,979✔
507
        if (r < 0)
6,979✔
508
                return r;
509

510
        *ret = TAKE_PTR(m);
6,959✔
511
        return 0;
6,959✔
512
}
513

514
int load_env_file_pairs_fd(int fd, const char *fname, char ***ret) {
5,401✔
515
        _cleanup_fclose_ FILE *f = NULL;
5,401✔
516
        int r;
5,401✔
517

518
        assert(fd >= 0);
5,401✔
519

520
        r = fdopen_independent(fd, "re", &f);
5,401✔
521
        if (r < 0)
5,401✔
522
                return r;
523

524
        return load_env_file_pairs(f, fname, ret);
5,401✔
525
}
526

527
static int merge_env_file_push(
53✔
528
                const char *filename, unsigned line,
529
                const char *key, char *value,
530
                void *userdata) {
531

532
        char ***env = ASSERT_PTR(userdata);
53✔
533
        char *expanded_value;
53✔
534
        int r;
53✔
535

536
        assert(key);
53✔
537

538
        if (!value) {
53✔
539
                log_error("%s:%u: invalid syntax (around \"%s\"), ignoring.", strna(filename), line, key);
20✔
540
                return 0;
10✔
541
        }
542

543
        if (!env_name_is_valid(key)) {
43✔
544
                log_error("%s:%u: invalid variable name \"%s\", ignoring.", strna(filename), line, key);
6✔
545
                free(value);
3✔
546
                return 0;
3✔
547
        }
548

549
        r = replace_env(value,
40✔
550
                        *env,
551
                        REPLACE_ENV_USE_ENVIRONMENT|REPLACE_ENV_ALLOW_BRACELESS|REPLACE_ENV_ALLOW_EXTENDED,
552
                        &expanded_value);
553
        if (r < 0)
40✔
554
                return log_error_errno(r, "%s:%u: Failed to expand variable '%s': %m", strna(filename), line, value);
×
555

556
        free_and_replace(value, expanded_value);
40✔
557

558
        log_debug("%s:%u: setting %s=%s", filename, line, key, value);
40✔
559

560
        return load_env_file_push(filename, line, key, value, env);
40✔
561
}
562

563
int merge_env_file(
186✔
564
                char ***env,
565
                FILE *f,
566
                const char *fname) {
567

568
        assert(env);
186✔
569
        assert(f || fname);
186✔
570

571
        /* NOTE: this function supports braceful and braceless variable expansions,
572
         * plus "extended" substitutions, unlike other exported parsing functions.
573
         */
574

575
        return parse_env_file_internal(f, fname, merge_env_file_push, env);
186✔
576
}
577

578
static void env_file_fputs_escaped(FILE *f, const char *p) {
10,593✔
579
        assert(f);
10,593✔
580
        assert(p);
10,593✔
581

582
        flockfile(f);
10,593✔
583

584
        if (string_has_cc(p, NULL) || chars_intersect(p, WHITESPACE SHELL_NEED_QUOTES)) {
10,593✔
585
                fputc_unlocked('"', f);
317✔
586

587
                for (; *p; p++) {
15,024✔
588
                        if (strchr(SHELL_NEED_ESCAPE, *p))
14,707✔
589
                                fputc_unlocked('\\', f);
724✔
590

591
                        fputc_unlocked(*p, f);
29,414✔
592
                }
593

594
                fputc_unlocked('"', f);
317✔
595
        } else
596
                fputs_unlocked(p, f);
10,276✔
597

598
        funlockfile(f);
10,593✔
599
}
10,593✔
600

601
void env_file_fputs_assignment(FILE *f, const char *k, const char *v) {
22,929✔
602
        assert(f);
22,929✔
603
        assert(k);
22,929✔
604

605
        if (!v)
22,929✔
606
                return;
607

608
        fputs(k, f);
10,083✔
609
        env_file_fputs_escaped(f, v);
10,083✔
610
        fputc('\n', f);
10,083✔
611
}
612

613
static void write_env_var(FILE *f, const char *v) {
510✔
614
        const char *p;
510✔
615

616
        assert(f);
510✔
617
        assert(v);
510✔
618

619
        p = strchr(v, '=');
510✔
620
        if (!p) {
510✔
621
                /* Fallback */
622
                fputs_unlocked(v, f);
×
623
                fputc_unlocked('\n', f);
×
624
                return;
×
625
        }
626

627
        p++;
510✔
628
        fwrite_unlocked(v, 1, p-v, f);
510✔
629

630
        env_file_fputs_escaped(f, p);
510✔
631

632
        fputc_unlocked('\n', f);
510✔
633
}
634

635
int write_env_file(int dir_fd, const char *fname, char **headers, char **l, WriteEnvFileFlags flags) {
290✔
636
        _cleanup_fclose_ FILE *f = NULL;
290✔
637
        _cleanup_free_ char *p = NULL;
290✔
638
        int r;
290✔
639

640
        assert(dir_fd >= 0 || dir_fd == AT_FDCWD);
290✔
641
        assert(fname);
290✔
642

643
        bool call_label_ops_post = false;
290✔
644
        if (FLAGS_SET(flags, WRITE_ENV_FILE_LABEL)) {
290✔
645
                r = label_ops_pre(dir_fd, fname, S_IFREG);
279✔
646
                if (r < 0)
279✔
647
                        return r;
648

649
                call_label_ops_post = true;
650
        }
651

652
        r = fopen_tmpfile_linkable_at(dir_fd, fname, O_WRONLY|O_CLOEXEC, &p, &f);
290✔
653
        if (call_label_ops_post)
290✔
654
                RET_GATHER(r, label_ops_post(f ? fileno(f) : dir_fd, f ? NULL : fname, /* created= */ !!f));
558✔
655
        if (r < 0)
290✔
656
                return r;
×
657

658
        r = fchmod_umask(fileno(f), 0644);
290✔
659
        if (r < 0)
290✔
660
                goto fail;
×
661

662
        STRV_FOREACH(i, headers) {
821✔
663
                assert(isempty(*i) || startswith(*i, "#"));
531✔
664
                fputs_unlocked(*i, f);
531✔
665
                fputc_unlocked('\n', f);
1,062✔
666
        }
667

668
        STRV_FOREACH(i, l)
800✔
669
                write_env_var(f, *i);
510✔
670

671
        r = flink_tmpfile_at(f, dir_fd, p, fname, LINK_TMPFILE_REPLACE|LINK_TMPFILE_SYNC);
290✔
672
        if (r < 0)
290✔
673
                goto fail;
×
674

675
        return 0;
676

677
fail:
×
678
        if (p)
×
679
                (void) unlinkat(dir_fd, p, 0);
×
680

681
        return r;
682
}
683

684
int write_vconsole_conf(int dir_fd, const char *fname, char **l) {
252✔
685
        char **headers = STRV_MAKE(
252✔
686
                "# Written by systemd-localed(8) or systemd-firstboot(1), read by systemd-localed",
687
                "# and systemd-vconsole-setup(8). Use localectl(1) to update this file.");
688

689
        return write_env_file(dir_fd, fname, headers, l, WRITE_ENV_FILE_LABEL);
252✔
690
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc