[Libguestfs] [PATCH 4/4] TSK: small refactoring
Pino Toscano
ptoscano at redhat.com
Mon Sep 19 09:41:56 UTC 2016
On Saturday, 17 September 2016 18:18:56 CEST Matteo Cafasso wrote:
> Removed duplicated code.
>
> Signed-off-by: Matteo Cafasso <noxdafox at gmail.com>
> ---
As mentioned in another email, I'd like this to be a single change
with the return parse_filesystem_walk -> parse_dirent_file rename.
> struct guestfs_tsk_dirent_list *
> guestfs_impl_filesystem_walk (guestfs_h *g, const char *mountable)
> {
> int ret = 0;
> - CLEANUP_FCLOSE FILE *fp = NULL;
> CLEANUP_UNLINK_FREE char *tmpfile = NULL;
>
> - ret = guestfs_int_lazy_make_tmpdir (g);
> - if (ret < 0)
> - return NULL;
> -
> - tmpfile = safe_asprintf (g, "%s/filesystem_walk%d", g->tmpdir, ++g->unique);
> + tmpfile = make_temp_file (g, "filesystem_walk");
Note you are not checking the return value of make_temp_file, which can
still fail (when guestfs_int_lazy_make_tmpdir fails, for example).
So you still need to check tmpfile, otherwise tmpfile may be used as
null pointer.
Thanks,
--
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20160919/7e1ed7f4/attachment.sig>
More information about the Libguestfs
mailing list