On 09/22/2010 01:16 AM, Denys Vlasenko wrote:
On Tue, 2010-09-21 at 11:59 +0200, Nikola Pajkovsky wrote:
> DD_CLOSE_ON_OPEN_ERR flag indicate to free all memory allocated by
> dd_init() which is passed to dd_opendir().
>
> dd_opendir fails when dump_dir does not exist.
>
> VERB1 log(_("Unable to open debug dump '%s'"), pDebugDumpDir);
> is all removed because there is error_msg("'%s' does not exist",
> dd->dd_dir); in dd_opendir().
...which sometimes we don't want to print
(example: crash dump directory trimming code
running concurrently. Second process may try to delete
a directory which is already gone. it should not complain
that it is missing.)
Can you add a DD_FAIL_QUIETLY flag to make it possible
to suppress that message?
yep
> @@ -863,35 +856,32 @@ static mw_result_t
SavePackageDescriptionToDebugDump(
> }
>
> struct dump_dir *dd = dd_init();
> - if (dd_opendir(dd, pDebugDumpDir))
> + if (!dd_opendir(dd, pDebugDumpDir, DD_CLOSE_ON_OPEN_ERR))
> + return MW_ERROR;
> +
> + if (rpm_pkg)
> {
> - if (rpm_pkg)
> - {
> - dd_save_text(dd, FILENAME_PACKAGE, rpm_pkg);
> - free(rpm_pkg);
> - }
> + dd_save_text(dd, FILENAME_PACKAGE, rpm_pkg);
> + free(rpm_pkg);
> + }
>
> - if (dsc)
> - {
> - dd_save_text(dd, FILENAME_DESCRIPTION, dsc);
> - free(dsc);
> - }
> + if (dsc)
> + {
> + dd_save_text(dd, FILENAME_DESCRIPTION, dsc);
> + free(dsc);
> + }
>
> - if (component)
> - {
> - dd_save_text(dd, FILENAME_COMPONENT, component);
> - free(component);
> - }
> + if (component)
> + {
> + dd_save_text(dd, FILENAME_COMPONENT, component);
> + free(component);
> + }
>
> - if (!remote)
> - dd_save_text(dd, FILENAME_HOSTNAME, host);
> + if (!remote)
> + dd_save_text(dd, FILENAME_HOSTNAME, host);
>
> - dd_close(dd);
> - return MW_OK;
> - }
> dd_close(dd);
> -
> - return MW_ERROR;
> + return MW_OK;
Can you make the change in this hunk less invasive
(that is, without if() statement restructuring)?
My other unrelated patch which I just posted touches
the same place.
Simpler change will help me to port the patch...
ok no problem
Looks good to me.
I will send another patch.
--
Nikola