libudev-util-private.c revision 912541b0246ef315d4d851237483b98c9dd3f992
/*
* libudev - interface to udev device information
*
* Copyright (C) 2003-2009 Kay Sievers <kay.sievers@vrfy.org>
*
* modify it 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.
*/
#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 <pwd.h>
#include <grp.h>
#include "libudev.h"
#include "libudev-private.h"
{
char p[UTIL_PATH_SIZE];
char *pos;
int err;
util_strscpy(p, sizeof(p), path);
return 0;
pos--;
if (pos == p)
return 0;
pos[0] = '\0';
return 0;
else
return -ENOTDIR;
}
if (err != 0)
return err;
if (selinux)
if (err != 0) {
err = 0;
else
}
}
if (selinux)
return err;
}
{
}
{
}
{
char p[UTIL_PATH_SIZE];
char *pos;
int err = 0;
if (path[0] == '/')
path++;
util_strscpy(p, sizeof(p), path);
return 0;
for (;;) {
*pos = '\0';
/* don't remove the last one */
break;
if (err < 0) {
err = 0;
break;
}
}
return err;
}
{
char *endptr;
return 0;
if (endptr[0] == '\0')
return uid;
else
return 0;
}
{
char *endptr;
char *buf;
return 0;
if (endptr[0] == '\0')
return gid;
gid = 0;
for (;;) {
char *newbuf;
if (!newbuf)
break;
buflen *= 2;
continue;
} else {
}
break;
}
return gid;
}
/* handle "[<SUBSYSTEM>/<KERNEL>]<attribute>" format */
{
char temp[UTIL_PATH_SIZE];
char *subsys;
char *sysname;
struct udev_device *dev;
char *attr;
if (string[0] != '[')
return -1;
return -1;
sysname[0] = '\0';
return -1;
attr[0] = '\0';
if (attr[0] == '/')
if (attr[0] == '\0')
return -1;
return -1;
if (read_value) {
const char *val;
else
result[0] = '\0';
} else {
size_t l;
char *s;
s = result;
}
return 0;
}