blob: 9b1fdac9299fff15ed46bbd760273b6370e5ed35 (
plain) (
tree)
|
|
#include <ctype.h>
#include <errno.h>
#include <sys/types.h>
int dbus_objpath_alnumify(char *path)
{
for (size_t i = 0; path[i]; i++) {
if (!isalnum(path[i]) && path[i] != '/')
path[i] = '_';
else if (i > 0 && path[i] == '/' && path[i - 1] == '/')
return -EINVAL;
}
return 0;
}
|