catalog: let's use mkdir_parents() and use same mode as tmpfiles.d for this dir
let's use mkdir_parents() (because its shorter), and 0755 as access mode, so that things have the access mode tmpfiles.d also suggests. Prompted by: #11903
This commit is contained in:
parent
0640d48afb
commit
3f1e2714a4
|
@ -371,21 +371,21 @@ int catalog_import_file(Hashmap *h, const char *path) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int64_t write_catalog(const char *database, struct strbuf *sb,
|
||||
CatalogItem *items, size_t n) {
|
||||
CatalogHeader header;
|
||||
static int64_t write_catalog(
|
||||
const char *database,
|
||||
struct strbuf *sb,
|
||||
CatalogItem *items,
|
||||
size_t n) {
|
||||
|
||||
_cleanup_fclose_ FILE *w = NULL;
|
||||
int r;
|
||||
_cleanup_free_ char *d, *p = NULL;
|
||||
_cleanup_free_ char *p = NULL;
|
||||
CatalogHeader header;
|
||||
size_t k;
|
||||
int r;
|
||||
|
||||
d = dirname_malloc(database);
|
||||
if (!d)
|
||||
return log_oom();
|
||||
|
||||
r = mkdir_p(d, 0775);
|
||||
r = mkdir_parents(database, 0755);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Recursive mkdir %s: %m", d);
|
||||
return log_error_errno(r, "Failed to create parent directories of %s: %m", database);
|
||||
|
||||
r = fopen_temporary(database, &w, &p);
|
||||
if (r < 0)
|
||||
|
|
Loading…
Reference in a new issue