* open_module_list() put the wrong base path length onto the stack, and thus,
no on-disk modules could be found... (since revision 16584). * iterator_get_next_module() now makes use of the KPath features, and doesn't build the new path manually anymore. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16745 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -774,27 +774,25 @@ nextModuleImage:
|
|||||||
goto nextModuleImage;
|
goto nextModuleImage;
|
||||||
|
|
||||||
// build absolute path to current file
|
// build absolute path to current file
|
||||||
KPath pathBuffer;
|
KPath path(iterator->current_path);
|
||||||
if (pathBuffer.InitCheck() != B_OK)
|
if (path.InitCheck() != B_OK)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
char *path = pathBuffer.LockBuffer();
|
if (path.Append(dirent->d_name) != B_OK)
|
||||||
strlcpy(path, iterator->current_path, sizeof(path));
|
return B_BUFFER_OVERFLOW;
|
||||||
strlcat(path, "/", sizeof(path));
|
|
||||||
strlcat(path, dirent->d_name, sizeof(path));
|
|
||||||
|
|
||||||
// find out if it's a directory or a file
|
// find out if it's a directory or a file
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (stat(path, &st) < 0)
|
if (stat(path.Path(), &st) < 0)
|
||||||
return errno;
|
return errno;
|
||||||
|
|
||||||
iterator->current_module_path = strdup(path);
|
iterator->current_module_path = strdup(path.Path());
|
||||||
if (iterator->current_module_path == NULL)
|
if (iterator->current_module_path == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
if (S_ISDIR(st.st_mode)) {
|
if (S_ISDIR(st.st_mode)) {
|
||||||
status = iterator_push_path_on_stack(iterator, iterator->current_module_path,
|
status = iterator_push_path_on_stack(iterator, iterator->current_module_path,
|
||||||
iterator->path_base_length);
|
iterator->path_base_length);
|
||||||
if (status < B_OK)
|
if (status < B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
@@ -805,9 +803,9 @@ nextModuleImage:
|
|||||||
if (!S_ISREG(st.st_mode))
|
if (!S_ISREG(st.st_mode))
|
||||||
return B_BAD_TYPE;
|
return B_BAD_TYPE;
|
||||||
|
|
||||||
TRACE(("open module at %s\n", path));
|
TRACE(("open module at %s\n", path.Path()));
|
||||||
|
|
||||||
status = get_module_image(path, &iterator->module_image);
|
status = get_module_image(path.Path(), &iterator->module_image);
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
free((void *)iterator->current_module_path);
|
free((void *)iterator->current_module_path);
|
||||||
iterator->current_module_path = NULL;
|
iterator->current_module_path = NULL;
|
||||||
@@ -1116,7 +1114,7 @@ open_module_list(const char *prefix)
|
|||||||
path[length] = '/';
|
path[length] = '/';
|
||||||
memcpy(path + length + 1, prefix, iterator->prefix_length + 1);
|
memcpy(path + length + 1, prefix, iterator->prefix_length + 1);
|
||||||
|
|
||||||
iterator_push_path_on_stack(iterator, path, strlen(path) + 1);
|
iterator_push_path_on_stack(iterator, path, length + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (void *)iterator;
|
return (void *)iterator;
|
||||||
|
|||||||
Reference in New Issue
Block a user