Clarify some error messages.

This commit is contained in:
kientzle 2005-05-08 06:25:15 +00:00
parent 6002c77e8f
commit 5fd4825f3c
4 changed files with 8 additions and 8 deletions

View File

@ -6,7 +6,7 @@
#
PROG= bsdtar
VERSION= 1.02.022
VERSION= 1.02.023
DIST_SRCS= bsdtar.c getdate.y matching.c read.c tree.c util.c write.c
SRCS= ${DIST_SRCS}
WARNS?= 5

View File

@ -309,13 +309,13 @@ tree_next(struct tree *t)
/* chdir() failed; return error */
tree_pop(t);
t->tree_errno = errno;
return (t->visit_type = TREE_ERROR);
return (t->visit_type = TREE_ERROR_DIR);
}
t->d = opendir(".");
if (t->d == NULL) {
tree_pop(t);
t->tree_errno = errno;
return (t->visit_type = TREE_ERROR);
return (t->visit_type = TREE_ERROR_DIR);
}
t->depth++;
t->flags &= ~hasLstat;

View File

@ -68,7 +68,7 @@ void tree_close(struct tree *);
#define TREE_REGULAR 1
#define TREE_POSTDESCENT 2
#define TREE_POSTASCENT 3
#define TREE_ERROR -1
#define TREE_ERROR_DIR -1
int tree_next(struct tree *);
int tree_errno(struct tree *);

View File

@ -537,14 +537,14 @@ write_hierarchy(struct bsdtar *bsdtar, struct archive *a, const char *path)
const struct stat *st = NULL, *lst = NULL;
int descend;
if (tree_ret == TREE_ERROR)
bsdtar_warnc(bsdtar, errno, "%s", name);
if (tree_ret == TREE_ERROR_DIR)
bsdtar_warnc(bsdtar, errno, "%s: Couldn't visit directory", name);
if (tree_ret != TREE_REGULAR)
continue;
lst = tree_current_lstat(tree);
if (lst == NULL) {
/* Couldn't lstat(); must not exist. */
bsdtar_warnc(bsdtar, errno, "%s: Cannot open", path);
bsdtar_warnc(bsdtar, errno, "%s: Cannot stat", path);
bsdtar->return_value = 1;
continue;
}
@ -744,7 +744,7 @@ write_entry(struct bsdtar *bsdtar, struct archive *a, const struct stat *st,
fd = open(accpath, O_RDONLY);
if (fd < 0) {
if (!bsdtar->verbose)
bsdtar_warnc(bsdtar, errno, "%s", pathname);
bsdtar_warnc(bsdtar, errno, "%s: could not open file", pathname);
else
fprintf(stderr, ": %s", strerror(errno));
goto cleanup;