Fix CE ls on non-directory filesystem paths
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m48s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m48s
This commit is contained in:
2
ce/ce.c
2
ce/ce.c
@@ -298,7 +298,9 @@ static void ls (const char* path_string) {
|
|||||||
describe (path, &desc);
|
describe (path, &desc);
|
||||||
|
|
||||||
if (desc.type != FS_DIR) {
|
if (desc.type != FS_DIR) {
|
||||||
|
printf ("ERROR '%s' is not a directory\n", path_string);
|
||||||
volume_close ();
|
volume_close ();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t entries = desc.size;
|
size_t entries = desc.size;
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ int tarfs_format (struct vfs_volume* volume) {
|
|||||||
int tarfs_describe (struct vfs_volume* volume, const char* path, struct desc* desc) {
|
int tarfs_describe (struct vfs_volume* volume, const char* path, struct desc* desc) {
|
||||||
struct tarfs* tarfs = volume->udata;
|
struct tarfs* tarfs = volume->udata;
|
||||||
|
|
||||||
if (strncmp (path, "/", PATH_MAX) == 0) {
|
if ((path[0] == '/') && (path[1] == '\0')) {
|
||||||
desc->size = 0;
|
desc->size = 0;
|
||||||
desc->type = FS_DIR;
|
desc->type = FS_DIR;
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,12 @@ static const char* str_status[] = {
|
|||||||
[ST_BAD_PATH] = "path parsing error",
|
[ST_BAD_PATH] = "path parsing error",
|
||||||
[ST_EXEC_ERROR] = "exec error",
|
[ST_EXEC_ERROR] = "exec error",
|
||||||
[ST_MOUNT_ERROR] = "mount error",
|
[ST_MOUNT_ERROR] = "mount error",
|
||||||
|
[ST_TRY_AGAIN] = "try again",
|
||||||
|
[ST_NOT_DIR] = "not a directory",
|
||||||
|
[ST_DIR_NO_ENTRIES] = "empty directory",
|
||||||
|
[ST_FORMAT_ERROR] = "filesystem formatting error",
|
||||||
|
[ST_NOT_DRV] = "not a drive device",
|
||||||
|
[ST_PARTITION_ERROR] = "partition error",
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _LIBSYSTEM_STR_STATUS_H
|
#endif // _LIBSYSTEM_STR_STATUS_H
|
||||||
|
|||||||
Reference in New Issue
Block a user