udev_utils_file.c revision 17fcfb5972977b6a3aedca6ad2aa8d1fbfbc761d
/*
* Copyright (C) 2004-2008 Kay Sievers <kay.sievers@vrfy.org>
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* 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, see <http://www.gnu.org/licenses/>.
*/
#include <stdlib.h>
#include <stdio.h>
#include <stddef.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <ctype.h>
#include <dirent.h>
#include "udev.h"
{
char p[UTIL_PATH_SIZE];
char *pos;
int ret;
util_strlcpy(p, path, sizeof(p));
return 0;
pos--;
pos[0] = '\0';
return 0;
if (create_path(udev, p) != 0)
return -1;
if (ret == 0)
return 0;
return 0;
return -1;
}
{
char p[UTIL_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;
}
}
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 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;
}
}