Hello, Mikhail Karpov, le jeu. 19 nov. 2026 11:06:06 +0700, a ecrit: > There are several places where the return values of the functions > fshelp_map_active_translators, fshelp_set_active, and fshelp_fetch_control > are not checked. Additionally, there are a few instances where the return > value of fshelp_remove_active_translator is not checked; however, since this > function always returns 0, should we even be concerned about it?
Yes, there is not reason for the function to fail. > From fe6aa0c62608a53932f44bd9167a18df3fe1cee6 Mon Sep 17 00:00:00 2001 > From: Mikhail Karpov <[email protected]> > Date: Thu, 19 Nov 2026 10:55:28 +0700 > Subject: [PATCH 2/2] Added checks for libfshelp functions return value in > several place > > --- > fatfs/dir.c | 4 +++- > libdiskfs/dir-unlink.c | 2 +- > libdiskfs/fsys-syncfs.c | 9 +++++++-- > libfshelp/fetch-root.c | 6 +++++- > libnetfs/fsys-syncfs.c | 8 ++++++-- > 5 files changed, 22 insertions(+), 7 deletions(-) > > diff --git a/fatfs/dir.c b/fatfs/dir.c > index d210bcc..4746188 100644 > --- a/fatfs/dir.c > +++ b/fatfs/dir.c > @@ -751,7 +751,9 @@ diskfs_dirrewrite_hard (struct node *dp, struct node *np, > struct dirstat *ds) > assert_backtrace (!oldnp->dn_stat.st_nlink); > > /* Close the file, free the referenced held by clients. */ > - fshelp_fetch_control (&oldnp->transbox, &control); > + err = fshelp_fetch_control (&oldnp->transbox, &control); > + if (err) > + return err; st_nlink-- was performed above, we'd want to exchange the two. > diff --git a/libdiskfs/dir-unlink.c b/libdiskfs/dir-unlink.c > index eaf62f9..3555d9e 100644 > --- a/libdiskfs/dir-unlink.c > +++ b/libdiskfs/dir-unlink.c > @@ -84,7 +84,7 @@ diskfs_S_dir_unlink (struct protid *dircred, > diskfs_node_update (np, diskfs_synchronous); > > if (np->dn_stat.st_nlink == 0) > - fshelp_fetch_control (&np->transbox, &control); > + err = fshelp_fetch_control (&np->transbox, &control); Similarly, we have already done some actions above. > diff --git a/libfshelp/fetch-root.c b/libfshelp/fetch-root.c > index a7cee33..fcd83d4 100644 > --- a/libfshelp/fetch-root.c > +++ b/libfshelp/fetch-root.c > @@ -195,7 +195,11 @@ fshelp_fetch_root (struct transbox *box, void *cookie, > > if ((err == MACH_SEND_INVALID_DEST || err == MIG_SERVER_DIED) > && control == box->active) > - fshelp_set_active (box, MACH_PORT_NULL, 0); > + { > + error_t err2 = fshelp_set_active (box, MACH_PORT_NULL, 0); > + if (err2) > + return err2; Here as well, we have a reference on control to release. > + } > else > mach_port_deallocate (mach_task_self (), control); > Samuel
