From 2a2585c5989c1f2c42922b9b4d3573c0a4ddf0d0 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Fri, 26 Jul 2002 19:59:08 +0000 Subject: [PATCH] Fixed an unchecked error in get_app_path(). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@459 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/storage/kernel_interface.POSIX.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/kits/storage/kernel_interface.POSIX.cpp b/src/kits/storage/kernel_interface.POSIX.cpp index 2e464fc711..196a6eb86e 100644 --- a/src/kits/storage/kernel_interface.POSIX.cpp +++ b/src/kits/storage/kernel_interface.POSIX.cpp @@ -1112,11 +1112,13 @@ StorageKit::get_app_path(char *buffer) image_info info; int32 cookie = 0; bool found = false; - while (!found && get_next_image_info(0, &cookie, &info) == B_OK) { - if (info.type == B_APP_IMAGE) { - strncpy(buffer, info.name, B_PATH_NAME_LENGTH); - buffer[B_PATH_NAME_LENGTH] = 0; - found = true; + if (error == B_OK) { + while (!found && get_next_image_info(0, &cookie, &info) == B_OK) { + if (info.type == B_APP_IMAGE) { + strncpy(buffer, info.name, B_PATH_NAME_LENGTH); + buffer[B_PATH_NAME_LENGTH] = 0; + found = true; + } } } if (error == B_OK && !found)