dropin.c revision 8eea868708923a092ee85d6146ba4c04b7baea06
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2014 Zbigniew Jędrzejewski-Szmek
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include "dropin.h"
#include "util.h"
#include "mkdir.h"
#include "fileio-label.h"
_cleanup_free_ char *b = NULL;
char *p, *q;
char prefix[DECIMAL_STR_MAX(unsigned)];
if (!b)
return -ENOMEM;
if (!filename_is_safe(b))
return -EINVAL;
if (!p)
return -ENOMEM;
if (!q) {
free(p);
return -ENOMEM;
}
*_p = p;
*_q = q;
return 0;
}
int r;
if (r < 0)
return r;
mkdir_p(p, 0755);
return write_string_file_atomic_label(q, data);
}
_cleanup_free_ char *p = NULL;
int r;
if (r < 0)
return -ENOMEM;
}