#include #include #include #include #include #include #include "common.h" int mkdir_dev(const char * name) { char pathname[PATH_MAX + 1] = "/dev/"; strcpy(pathname + 5, name); return (mkdir(pathname, 0755) == 0 || errno == EEXIST) ? 0 : -1; } int mkdirs_dev(const char * name, ...) { va_list args; int ret = 0; va_start(args, name); for (; name; name = va_arg(args, const char *)) if (mkdir_dev(name) && errno != EEXIST) { ret = -1; break; } va_end(args); return ret; }