udev_utils_file.c revision 726687ad48bdececed1e7e44387c50e009e28208
/*
* Copyright (C) 2004-2005 Kay Sievers <kay.sievers@vrfy.org>
*
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*
* This program 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <stddef.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <ctype.h>
#include <dirent.h>
#include "udev.h"
#include "udev_selinux.h"
int create_path(const char *path)
{
char p[PATH_SIZE];
char *pos;
int ret;
return 0;
pos--;
pos[0] = '\0';
dbg("stat '%s'\n", p);
return 0;
if (create_path(p) != 0)
return -1;
dbg("mkdir '%s'\n", p);
if (ret == 0)
return 0;
return 0;
return -1;
}
int delete_path(const char *path)
{
char p[PATH_SIZE];
char *pos;
int retval;
return 0;
while (1) {
*pos = '\0';
/* don't remove the last one */
break;
/* remove if empty */
retval = 0;
if (retval) {
return 0;
break;
}
dbg("removed '%s'\n", p);
}
return 0;
}
/* Reset permissions on the device node, before unlinking it to make sure,
* that permisions of possible hard links will be removed too.
*/
int unlink_secure(const char *filename)
{
int retval;
if (retval)
if (retval)
retval = 0;
if (retval)
return retval;
}
{
int fd;
if (fd < 0) {
return -1;
}
return -1;
}
if (*buf == MAP_FAILED) {
return -1;
}
return 0;
}
{
}
/* return number of chars until the next newline, skip escaped newline */
{
int escape = 0;
break;
escape = 1;
else
escape = 0;
}
}