version 1.77, 2006/04/05 01:38:56 |
version 1.78, 2006/04/14 02:45:35 |
|
|
return (-1); |
return (-1); |
} |
} |
dlen = strlen(dst); |
dlen = strlen(dst); |
if ((dlen > 0) && (dst[dlen - 1] == '\n')) |
if (dlen > 0 && dst[dlen - 1] == '\n') |
dst[--dlen] = '\0'; |
dst[--dlen] = '\0'; |
|
|
(void)fclose(fp); |
(void)fclose(fp); |
|
|
continue; |
continue; |
} |
} |
|
|
if ((type <= 'a') || (type >= 'z') || |
if (type <= 'a' || type >= 'z' || |
(cvs_modetypes[type - 'a'] == -1)) { |
cvs_modetypes[type - 'a'] == -1) { |
cvs_log(LP_WARN, |
cvs_log(LP_WARN, |
"invalid mode type `%c'" |
"invalid mode type `%c'" |
" (`u', `g' or `o' expected), ignoring", type); |
" (`u', `g' or `o' expected), ignoring", type); |
|
|
type = cvs_modetypes[type - 'a']; |
type = cvs_modetypes[type - 'a']; |
|
|
for (sp = ms; *sp != '\0'; sp++) { |
for (sp = ms; *sp != '\0'; sp++) { |
if ((*sp <= 'a') || (*sp >= 'z') || |
if (*sp <= 'a' || *sp >= 'z' || |
(cvs_modes[(int)type][*sp - 'a'] == 0)) { |
cvs_modes[(int)type][*sp - 'a'] == 0) { |
cvs_log(LP_WARN, |
cvs_log(LP_WARN, |
"invalid permission bit `%c'", *sp); |
"invalid permission bit `%c'", *sp); |
} else |
} else |
|
|
if ((rlen = strlcpy(base, path, blen)) >= blen) |
if ((rlen = strlcpy(base, path, blen)) >= blen) |
fatal("cvs_splitpath: path truncation"); |
fatal("cvs_splitpath: path truncation"); |
|
|
while ((rlen > 0) && (base[rlen - 1] == '/')) |
while (rlen > 0 && base[rlen - 1] == '/') |
base[--rlen] = '\0'; |
base[--rlen] = '\0'; |
|
|
sp = strrchr(base, '/'); |
sp = strrchr(base, '/'); |
|
|
if (l >= sizeof(path)) |
if (l >= sizeof(path)) |
fatal("cvs_mkadmin: path truncation"); |
fatal("cvs_mkadmin: path truncation"); |
|
|
if ((mkdir(path, 0755) == -1) && (errno != EEXIST)) |
if (mkdir(path, 0755) == -1 && errno != EEXIST) |
fatal("cvs_mkadmin: mkdir: `%s': %s", path, strerror(errno)); |
fatal("cvs_mkadmin: mkdir: `%s': %s", path, strerror(errno)); |
|
|
/* just create an empty Entries file */ |
/* just create an empty Entries file */ |
|
|
if (l >= sizeof(path)) |
if (l >= sizeof(path)) |
fatal("cvs_mkadmin: path truncation"); |
fatal("cvs_mkadmin: path truncation"); |
|
|
if ((stat(path, &st) == -1) && (errno == ENOENT)) { |
if (stat(path, &st) == -1 && errno == ENOENT) { |
if ((fp = fopen(path, "w")) == NULL) |
if ((fp = fopen(path, "w")) == NULL) |
fatal("cvs_mkadmin: fopen: `%s': %s", |
fatal("cvs_mkadmin: fopen: `%s': %s", |
path, strerror(errno)); |
path, strerror(errno)); |
|
|
if (l >= sizeof(path)) |
if (l >= sizeof(path)) |
fatal("cvs_mkadmin: path truncation"); |
fatal("cvs_mkadmin: path truncation"); |
|
|
if ((stat(path, &st) == -1) && (errno == ENOENT)) { |
if (stat(path, &st) == -1 && errno == ENOENT) { |
if ((fp = fopen(path, "w")) == NULL) |
if ((fp = fopen(path, "w")) == NULL) |
fatal("cvs_mkadmin: fopen: `%s': %s", |
fatal("cvs_mkadmin: fopen: `%s': %s", |
path, strerror(errno)); |
path, strerror(errno)); |
|
|
if (cvs_noexec == 1) |
if (cvs_noexec == 1) |
return (0); |
return (0); |
|
|
if ((unlink(path) == -1) && (errno != ENOENT)) { |
if (unlink(path) == -1 && errno != ENOENT) { |
cvs_log(LP_ERRNO, "cannot remove `%s'", path); |
cvs_log(LP_ERRNO, "cannot remove `%s'", path); |
return (-1); |
return (-1); |
} |
} |
|
|
if (ent->d_type == DT_DIR) { |
if (ent->d_type == DT_DIR) { |
if (cvs_rmdir(fpath) == -1) |
if (cvs_rmdir(fpath) == -1) |
goto done; |
goto done; |
} else if ((cvs_unlink(fpath) == -1) && (errno != ENOENT)) |
} else if (cvs_unlink(fpath) == -1 && errno != ENOENT) |
goto done; |
goto done; |
} |
} |
|
|
|
|
if ((rmdir(path) == -1) && (errno != ENOENT)) { |
if (rmdir(path) == -1 && errno != ENOENT) { |
cvs_log(LP_ERRNO, "failed to remove '%s'", path); |
cvs_log(LP_ERRNO, "failed to remove '%s'", path); |
goto done; |
goto done; |
} |
} |
|
|
CVSENTRIES *entf; |
CVSENTRIES *entf; |
struct cvs_ent *ent; |
struct cvs_ent *ent; |
|
|
if ((create_adm == 1) && (root == NULL)) |
if (create_adm == 1 && root == NULL) |
fatal("cvs_create_dir failed"); |
fatal("cvs_create_dir failed"); |
|
|
s = xstrdup(path); |
s = xstrdup(path); |
|
|
while (d != NULL) { |
while (d != NULL) { |
if (stat(d, &sb)) { |
if (stat(d, &sb)) { |
/* try to create the directory */ |
/* try to create the directory */ |
if ((errno != ENOENT) || (mkdir(d, 0755) && |
if (errno != ENOENT || |
errno != EEXIST)) { |
(mkdir(d, 0755) && errno != EEXIST)) { |
cvs_log(LP_ERRNO, "failed to create `%s'", d); |
cvs_log(LP_ERRNO, "failed to create `%s'", d); |
goto done; |
goto done; |
} |
} |
|
|
if (strlcpy(tagpath, CVS_PATH_TAG, sizeof(tagpath)) >= sizeof(tagpath)) |
if (strlcpy(tagpath, CVS_PATH_TAG, sizeof(tagpath)) >= sizeof(tagpath)) |
return; |
return; |
|
|
if ((tag != NULL) || (date != NULL)) { |
if (tag != NULL || date != NULL) { |
fp = fopen(tagpath, "w+"); |
fp = fopen(tagpath, "w+"); |
if (fp == NULL) { |
if (fp == NULL) { |
if (errno != ENOENT) |
if (errno != ENOENT) |