PackageWriterImpl::_AddEntry(): Improve output

Print the relative path instead of only the leaf name.
This commit is contained in:
Ingo Weinhold 2011-07-02 04:50:51 +02:00
parent 82af91fb0e
commit ffa2b2104b

View File

@ -694,8 +694,8 @@ PackageWriterImpl::_AddEntry(int dirFD, Entry* entry, const char* fileName,
fd = openat(dirFD, fileName, fd = openat(dirFD, fileName,
O_RDONLY | (isImplicitEntry ? 0 : O_NOTRAVERSE)); O_RDONLY | (isImplicitEntry ? 0 : O_NOTRAVERSE));
if (fd < 0) { if (fd < 0) {
fListener->PrintError("Failed to open entry \"%s\": %s\n", fileName, fListener->PrintError("Failed to open entry \"%s\": %s\n",
strerror(errno)); pathBuffer, strerror(errno));
throw status_t(errno); throw status_t(errno);
} }
fdCloser.SetTo(fd); fdCloser.SetTo(fd);
@ -704,7 +704,7 @@ PackageWriterImpl::_AddEntry(int dirFD, Entry* entry, const char* fileName,
// stat the node // stat the node
struct stat st; struct stat st;
if (fstat(fd, &st) < 0) { if (fstat(fd, &st) < 0) {
fListener->PrintError("Failed to fstat() file \"%s\": %s\n", fileName, fListener->PrintError("Failed to fstat() file \"%s\": %s\n", pathBuffer,
strerror(errno)); strerror(errno));
throw status_t(errno); throw status_t(errno);
} }
@ -712,7 +712,7 @@ PackageWriterImpl::_AddEntry(int dirFD, Entry* entry, const char* fileName,
// implicit entries must be directories // implicit entries must be directories
if (isImplicitEntry && !S_ISDIR(st.st_mode)) { if (isImplicitEntry && !S_ISDIR(st.st_mode)) {
fListener->PrintError("Non-leaf path component \"%s\" is not a " fListener->PrintError("Non-leaf path component \"%s\" is not a "
"directory\n", fileName); "directory\n", pathBuffer);
throw status_t(B_BAD_VALUE); throw status_t(B_BAD_VALUE);
} }
@ -731,7 +731,7 @@ PackageWriterImpl::_AddEntry(int dirFD, Entry* entry, const char* fileName,
} else { } else {
// unsupported node type // unsupported node type
fListener->PrintError("Unsupported node type, entry: \"%s\"\n", fListener->PrintError("Unsupported node type, entry: \"%s\"\n",
fileName); pathBuffer);
throw status_t(B_UNSUPPORTED); throw status_t(B_UNSUPPORTED);
} }
@ -772,7 +772,7 @@ PackageWriterImpl::_AddEntry(int dirFD, Entry* entry, const char* fileName,
B_PATH_NAME_LENGTH); B_PATH_NAME_LENGTH);
if (bytesRead < 0) { if (bytesRead < 0) {
fListener->PrintError("Failed to read symlink \"%s\": %s\n", fListener->PrintError("Failed to read symlink \"%s\": %s\n",
fileName, strerror(errno)); pathBuffer, strerror(errno));
throw status_t(errno); throw status_t(errno);
} }
@ -789,7 +789,7 @@ PackageWriterImpl::_AddEntry(int dirFD, Entry* entry, const char* fileName,
if (fs_stat_attr(fd, entry->d_name, &attrInfo) < 0) { if (fs_stat_attr(fd, entry->d_name, &attrInfo) < 0) {
fListener->PrintError( fListener->PrintError(
"Failed to stat attribute \"%s\" of file \"%s\": %s\n", "Failed to stat attribute \"%s\" of file \"%s\": %s\n",
entry->d_name, fileName, strerror(errno)); entry->d_name, pathBuffer, strerror(errno));
throw status_t(errno); throw status_t(errno);
} }
@ -831,7 +831,7 @@ PackageWriterImpl::_AddEntry(int dirFD, Entry* entry, const char* fileName,
DIR* dir = fdopendir(clonedFD); DIR* dir = fdopendir(clonedFD);
if (dir == NULL) { if (dir == NULL) {
fListener->PrintError( fListener->PrintError(
"Failed to open directory \"%s\": %s\n", fileName, "Failed to open directory \"%s\": %s\n", pathBuffer,
strerror(errno)); strerror(errno));
close(clonedFD); close(clonedFD);
throw status_t(errno); throw status_t(errno);