-/* 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;
-
- retval = chown(filename, 0, 0);
- if (retval)
- dbg("chown(%s, 0, 0) failed with error '%s'", filename, strerror(errno));
-
- retval = chmod(filename, 0000);
- if (retval)
- dbg("chmod(%s, 0000) failed with error '%s'", filename, strerror(errno));
-
- retval = unlink(filename);
- if (errno == ENOENT)
- retval = 0;
-
- if (retval)
- dbg("unlink(%s) failed with error '%s'", filename, strerror(errno));
-
- return retval;
-}
-
-int parse_get_pair(char **orig_string, char **left, char **right)
-{
- char *temp;
- char *string = *orig_string;
-
- if (!string)
- return -ENODEV;
-
- /* eat any whitespace */
- while (isspace(*string) || *string == ',')
- ++string;
-
- /* split based on '=' */
- temp = strsep(&string, "=");
- *left = temp;
- if (!string)
- return -ENODEV;
-
- /* take the right side and strip off the '"' */
- while (isspace(*string))
- ++string;
- if (*string == '"')
- ++string;
- else
- return -ENODEV;
-
- temp = strsep(&string, "\"");
- if (!string || *temp == '\0')
- return -ENODEV;
- *right = temp;
- *orig_string = string;
-