Fix epoch in rpm and rpmdb importer: epoch is an integer tag.
8 #include "razor-internal.h"
11 razor_create_dir(const char *root, const char *path)
13 char buffer[PATH_MAX], *p;
14 const char *slash, *next;
17 /* Create all sub-directories in dir and then create name. We
18 * know root exists and is a dir, root does not end in a '/',
19 * and path has a leading '/'. */
22 p = buffer + strlen(buffer);
24 for (slash = path; slash[1] != '\0'; slash = next) {
25 next = strchr(slash + 1, '/');
26 memcpy(p, slash, next - slash);
30 if (stat(buffer, &buf) == 0) {
31 if (!S_ISDIR(buf.st_mode)) {
33 "%s exists but is not a directory\n",
37 } else if (mkdir(buffer, 0777) < 0) {
38 fprintf(stderr, "failed to make directory %s: %m\n",
43 /* FIXME: What to do about permissions for dirs we
44 * have to create but are not in the cpio archive? */
51 razor_write(int fd, const void *data, size_t size)
55 const unsigned char *p;
60 written = write(fd, p, rest);
62 fprintf(stderr, "write error: %m\n");