mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-04-04 00:00:04 +03:00
cmd_mount: don't return 0 on mount failure
Signed-off-by: Linus Heckemann <git@sphalerite.org>
This commit is contained in:
parent
9d26fad294
commit
0de1fb41b7
@ -254,8 +254,7 @@ int main(int argc, char *argv[])
|
|||||||
return cmd_setattr(argc, argv);
|
return cmd_setattr(argc, argv);
|
||||||
#ifndef BCACHEFS_NO_RUST
|
#ifndef BCACHEFS_NO_RUST
|
||||||
if (!strcmp(cmd, "mount")) {
|
if (!strcmp(cmd, "mount")) {
|
||||||
cmd_mount(argc, argv);
|
return cmd_mount(argc, argv);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
2
cmds.h
2
cmds.h
@ -60,6 +60,6 @@ int cmd_subvolume_delete(int argc, char *argv[]);
|
|||||||
int cmd_subvolume_snapshot(int argc, char *argv[]);
|
int cmd_subvolume_snapshot(int argc, char *argv[]);
|
||||||
|
|
||||||
int cmd_fusemount(int argc, char *argv[]);
|
int cmd_fusemount(int argc, char *argv[]);
|
||||||
void cmd_mount(int agc, char *argv[]);
|
int cmd_mount(int agc, char *argv[]);
|
||||||
|
|
||||||
#endif /* _CMDS_H */
|
#endif /* _CMDS_H */
|
||||||
|
@ -219,14 +219,14 @@ fn cmd_mount_inner(opt: Cli) -> anyhow::Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn cmd_mount(argc: c_int, argv: *const *const c_char) {
|
pub extern "C" fn cmd_mount(argc: c_int, argv: *const *const c_char) -> c_int {
|
||||||
let argv: Vec<_> = (0..argc)
|
let argv: Vec<_> = (0..argc)
|
||||||
.map(|i| unsafe { CStr::from_ptr(*argv.add(i as usize)) })
|
.map(|i| unsafe { CStr::from_ptr(*argv.add(i as usize)) })
|
||||||
.map(|i| OsStr::from_bytes(i.to_bytes()))
|
.map(|i| OsStr::from_bytes(i.to_bytes()))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let opt = Cli::parse_from(argv);
|
let opt = Cli::parse_from(argv);
|
||||||
|
|
||||||
log::set_boxed_logger(Box::new(SimpleLogger)).unwrap();
|
log::set_boxed_logger(Box::new(SimpleLogger)).unwrap();
|
||||||
|
|
||||||
// @TODO : more granular log levels via mount option
|
// @TODO : more granular log levels via mount option
|
||||||
@ -239,7 +239,9 @@ pub extern "C" fn cmd_mount(argc: c_int, argv: *const *const c_char) {
|
|||||||
colored::control::set_override(opt.colorize);
|
colored::control::set_override(opt.colorize);
|
||||||
if let Err(e) = cmd_mount_inner(opt) {
|
if let Err(e) = cmd_mount_inner(opt) {
|
||||||
error!("Fatal error: {}", e);
|
error!("Fatal error: {}", e);
|
||||||
|
1
|
||||||
} else {
|
} else {
|
||||||
info!("Successfully mounted");
|
info!("Successfully mounted");
|
||||||
|
0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user