Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display errno string for realpath for debug purpose #1535

Merged
merged 1 commit into from
May 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/lib/image/image.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ struct image_object singularity_image_init(char *path, int open_flags) {

real_path = realpath(path, NULL); // Flawfinder: ignore
if ( real_path == NULL ) {
singularity_message(ERROR, "Image path %s doesn't exist\n", path);
singularity_message(ERROR, "Image path %s doesn't exist: %s\n", path, strerror(errno));
ABORT(255);
}

Expand Down Expand Up @@ -297,7 +297,7 @@ void singularity_limit_container_paths(struct image_object *image) {

current_path = realpath(current, NULL); // Flawfinder: ignore
if ( current_path == NULL ) {
singularity_message(WARNING, "Configuration limit container path contains an invalid path %s\n", current);
singularity_message(WARNING, "Configuration limit container path contains an invalid path %s: %s\n", current, strerror(errno));
ABORT(255);
}

Expand Down Expand Up @@ -326,7 +326,7 @@ void singularity_limit_container_paths(struct image_object *image) {

current_path = realpath(current, NULL); // Flawfinder: ignore
if ( current_path == NULL ) {
singularity_message(WARNING, "Configuration limit container path contains an invalid path %s\n", current);
singularity_message(WARNING, "Configuration limit container path contains an invalid path %s: %s\n", current, strerror(errno));
ABORT(255);
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/util/mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,28 @@ static void resolve_container_path(struct resolved_container_path *container_pat
if ( container_path->mountdir == NULL ) {
container_path->mountdir = realpath(CONTAINER_MOUNTDIR, NULL); // Flawfinder: ignore
if ( container_path->mountdir == NULL ) {
singularity_message(ERROR, "Failed to resolve path to %s\n", CONTAINER_MOUNTDIR);
singularity_message(ERROR, "Failed to resolve path to %s: %s\n", CONTAINER_MOUNTDIR, strerror(errno));
ABORT(255);
}
}
if ( container_path->finaldir == NULL ) {
container_path->finaldir = realpath(CONTAINER_FINALDIR, NULL); // Flawfinder: ignore
if ( container_path->finaldir == NULL ) {
singularity_message(ERROR, "Failed to resolve path to %s\n", CONTAINER_FINALDIR);
singularity_message(ERROR, "Failed to resolve path to %s: %s\n", CONTAINER_FINALDIR, strerror(errno));
ABORT(255);
}
}
if ( container_path->overlay == NULL ) {
container_path->overlay = realpath(CONTAINER_OVERLAY, NULL); // Flawfinder: ignore
if ( container_path->overlay == NULL ) {
singularity_message(ERROR, "Failed to resolve path to %s\n", CONTAINER_OVERLAY);
singularity_message(ERROR, "Failed to resolve path to %s: %s\n", CONTAINER_OVERLAY, strerror(errno));
ABORT(255);
}
}
if ( container_path->session == NULL ) {
container_path->session = realpath(SESSIONDIR, NULL); // Flawfinder: ignore
if ( container_path->session == NULL ) {
singularity_message(ERROR, "Failed to resolve path to %s\n", SESSIONDIR);
singularity_message(ERROR, "Failed to resolve path to %s: %s\n", SESSIONDIR, strerror(errno));
ABORT(255);
}
}
Expand All @@ -86,7 +86,7 @@ int singularity_mount(const char *source, const char *target,

realdest = realpath(target, NULL); // Flawfinder: ignore
if ( realdest == NULL ) {
singularity_message(ERROR, "Failed to get real path of %s\n", target);
singularity_message(ERROR, "Failed to get real path of %s: %s\n", target, strerror(errno));
ABORT(255);
}

Expand Down