On Saturday, 17 September 2016 18:18:56 CEST Matteo Cafasso wrote:
Removed duplicated code.
Signed-off-by: Matteo Cafasso <noxdafox@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