diff --git a/ports/src/noux/child_env.h b/ports/src/noux/child_env.h index f2a095ab1e..ab26f33f28 100644 --- a/ports/src/noux/child_env.h +++ b/ports/src/noux/child_env.h @@ -115,8 +115,8 @@ namespace Noux { /* copy interpreter name into argument buffer */ unsigned int args_buf_cursor = 0; Genode::strncpy(&_args[args_buf_cursor], - &binary_addr[interpreter_name_start], - interpreter_name_len + 1); + &binary_addr[interpreter_name_start], + interpreter_name_len + 1); _binary_name = &_args[args_buf_cursor]; args_buf_cursor += interpreter_name_len + 1; @@ -130,8 +130,8 @@ namespace Noux { size_t interpreter_args_len = eol - interpreter_line_cursor; if (interpreter_args_len > 0) { Genode::strncpy(&_args[args_buf_cursor], - &binary_addr[interpreter_line_cursor], - interpreter_args_len + 1); + &binary_addr[interpreter_line_cursor], + interpreter_args_len + 1); args_buf_cursor += interpreter_args_len + 1; } @@ -157,7 +157,6 @@ namespace Noux { Sysio::Env const &env() const { return _env; } }; - } #endif /* _NOUX__CHILD_ENV_H_ */ diff --git a/ports/src/noux/dir_file_system.h b/ports/src/noux/dir_file_system.h index 72b665b906..210ffa2112 100644 --- a/ports/src/noux/dir_file_system.h +++ b/ports/src/noux/dir_file_system.h @@ -190,9 +190,8 @@ namespace Noux { sysio->error.stat = Sysio::STAT_ERR_NO_ENTRY; /* path does not match directory name */ - if (!path) { + if (!path) return false; - } /* * If path equals directory name, return information about the @@ -274,6 +273,7 @@ namespace Noux { sysio->dirent_out.entry.fileno = 1; } else sysio->dirent_out.entry.type = Sysio::DIRENT_TYPE_END; + return true; } @@ -283,6 +283,7 @@ namespace Noux { if (_is_root()) { return _dirent_of_file_systems(sysio, path, index); + } else { if (strcmp(path, "/") == 0) @@ -426,9 +427,8 @@ namespace Noux { sysio->error.unlink = Sysio::UNLINK_ERR_NO_ENTRY; /* path does not match directory name */ - if (!path) { + if (!path) return false; - } /* * Prevent unlinking if path equals directory name defined @@ -473,9 +473,8 @@ namespace Noux { sysio->error.readlink = Sysio::READLINK_ERR_NO_ENTRY; /* path does not match directory name */ - if (!path) { + if (!path) return false; - } /* path refers to any of our sub file systems */ for (File_system *fs = _first_file_system; fs; fs = fs->next) { @@ -506,9 +505,8 @@ namespace Noux { sysio->error.rename = Sysio::RENAME_ERR_NO_ENTRY; /* path does not match directory name */ - if (!from_path) { + if (!from_path) return false; - } /* * Prevent renaming if path equals directory name defined @@ -533,6 +531,7 @@ namespace Noux { for (File_system *fs = _first_file_system; fs; fs = fs->next) { if (fs->rename(sysio, from_path, to_path)) { return true; + } else { /* * Keep the most meaningful error code. When using @@ -558,9 +557,8 @@ namespace Noux { sysio->error.symlink = Sysio::SYMLINK_ERR_NO_ENTRY; /* path does not match directory name */ - if (!path) { + if (!path) return false; - } /* * Prevent symlink of path that equals directory name defined @@ -575,6 +573,7 @@ namespace Noux { for (File_system *fs = _first_file_system; fs; fs = fs->next) { if (fs->symlink(sysio, path)) { return true; + } else { /* * Keep the most meaningful error code. When using @@ -600,9 +599,8 @@ namespace Noux { sysio->error.mkdir = Sysio::MKDIR_ERR_NO_ENTRY; /* path does not match directory name */ - if (!path) { + if (!path) return false; - } /* * Prevent mkdir of path that equals directory name defined diff --git a/ports/src/noux/directory_service.h b/ports/src/noux/directory_service.h index bfee517c5d..45de6840ae 100644 --- a/ports/src/noux/directory_service.h +++ b/ports/src/noux/directory_service.h @@ -39,7 +39,7 @@ namespace Noux { virtual bool unlink(Sysio *sysio, char const *path) = 0; virtual bool readlink(Sysio *sysio, char const *path) = 0; virtual bool rename(Sysio *sysio, char const *from_path, - char const *to_path) = 0; + char const *to_path) = 0; virtual bool mkdir(Sysio *sysio, char const *path) = 0; virtual bool symlink(Sysio *sysio, char const *path) = 0; diff --git a/ports/src/noux/fs_file_system.h b/ports/src/noux/fs_file_system.h index b05007afde..297e40efa5 100644 --- a/ports/src/noux/fs_file_system.h +++ b/ports/src/noux/fs_file_system.h @@ -310,11 +310,17 @@ namespace Noux { Directory_entry const *entry = (Directory_entry *)source.packet_content(packet); - Sysio::Dirent_type type; + /* + * The default value has no meaning because the switch below + * assigns a value in each possible branch. But it is needed to + * keep the compiler happy. + */ + Sysio::Dirent_type type = Sysio::DIRENT_TYPE_END; + switch (entry->type) { - case Directory_entry::TYPE_DIRECTORY: type = Sysio::DIRENT_TYPE_DIRECTORY; break; - case Directory_entry::TYPE_FILE: type = Sysio::DIRENT_TYPE_FILE; break; - case Directory_entry::TYPE_SYMLINK: type = Sysio::DIRENT_TYPE_SYMLINK; break; + case Directory_entry::TYPE_DIRECTORY: type = Sysio::DIRENT_TYPE_DIRECTORY; break; + case Directory_entry::TYPE_FILE: type = Sysio::DIRENT_TYPE_FILE; break; + case Directory_entry::TYPE_SYMLINK: type = Sysio::DIRENT_TYPE_SYMLINK; break; } sysio->dirent_out.entry.type = type; diff --git a/ports/src/noux/main.cc b/ports/src/noux/main.cc index 37db82b2e1..cd231f36bc 100644 --- a/ports/src/noux/main.cc +++ b/ports/src/noux/main.cc @@ -255,14 +255,15 @@ bool Noux::Child::syscall(Noux::Session::Syscall sc) case SYSCALL_EXECVE: { - Dataspace_capability binary_ds = _root_dir->dataspace(_sysio->execve_in.filename); + Dataspace_capability binary_ds = + _root_dir->dataspace(_sysio->execve_in.filename); if (!binary_ds.valid()) throw Child::Binary_does_not_exist(); - Child_envexecve_in.args)> child_env( - _sysio->execve_in.filename, binary_ds, _sysio->execve_in.args, - _sysio->execve_in.env); + Child_envexecve_in.args)> + child_env(_sysio->execve_in.filename, binary_ds, + _sysio->execve_in.args, _sysio->execve_in.env); _root_dir->release(_sysio->execve_in.filename, binary_ds); diff --git a/ports/src/noux/rm_session_component.h b/ports/src/noux/rm_session_component.h index 2683532123..3335d018bd 100644 --- a/ports/src/noux/rm_session_component.h +++ b/ports/src/noux/rm_session_component.h @@ -61,7 +61,7 @@ namespace Noux { Region *curr = _regions.first(); for (; curr; curr = curr->next()) { if (curr->contains(local_addr)) - return curr; + return curr; } return 0; } diff --git a/ports/src/noux/terminal_file_system.h b/ports/src/noux/terminal_file_system.h index 6b5f3e51da..38be2a1120 100644 --- a/ports/src/noux/terminal_file_system.h +++ b/ports/src/noux/terminal_file_system.h @@ -46,7 +46,7 @@ namespace Noux { bool _is_terminal_file(const char *path) { return (strlen(path) == (strlen(_filename) + 1)) && - (strcmp(&path[1], _filename) == 0); + (strcmp(&path[1], _filename) == 0); } public: diff --git a/ports/src/noux/terminal_io_channel.h b/ports/src/noux/terminal_io_channel.h index 1f5c251f78..ccf098a773 100644 --- a/ports/src/noux/terminal_io_channel.h +++ b/ports/src/noux/terminal_io_channel.h @@ -120,18 +120,13 @@ namespace Noux { switch (sysio->fcntl_in.cmd) { case Sysio::FCNTL_CMD_GET_FILE_STATUS_FLAGS: - { sysio->fcntl_out.result = 0; return true; - } default: - { return false; } - } - return false; } diff --git a/ports/src/noux/user_info.h b/ports/src/noux/user_info.h index 5b7da400ee..4647fa807e 100644 --- a/ports/src/noux/user_info.h +++ b/ports/src/noux/user_info.h @@ -24,6 +24,7 @@ namespace Noux { struct User_info { + public: char name[Sysio::MAX_USERNAME_LEN]; diff --git a/ports/src/noux/zero_file_system.h b/ports/src/noux/zero_file_system.h index 65ba21f65d..ad19f0eaa2 100644 --- a/ports/src/noux/zero_file_system.h +++ b/ports/src/noux/zero_file_system.h @@ -39,7 +39,7 @@ namespace Noux { bool _is_device_zero_file(const char *path) { return (strlen(path) == (strlen(_filename()) + 1)) && - (strcmp(&path[1], _filename()) == 0); + (strcmp(&path[1], _filename()) == 0); } public: