static int fsmOpen(FD_t *wfdp, const char *dest)
{
    int rc = 0;
    /* Create the file with 0200 permissions (write by owner). */
    {
	mode_t old_umask = umask(0577);
	*wfdp = Fopen(dest, "wx.ufdio");
	umask(old_umask);
    }

    if (Ferror(*wfdp))
	rc = RPMERR_OPEN_FAILED;

    if (_fsm_debug) {
	rpmlog(RPMLOG_DEBUG, " %8s (%s [%d]) %s\n", __func__,
	       dest, Fileno(*wfdp), (rc < 0 ? strerror(errno) : ""));
    }

    if (rc)
	fsmClose(wfdp);

    return rc;
}
static int fsmOpen(FD_t *wfdp, const char *dest)
{
    int rc = 0;
     
    {
	mode_t old_umask = umask(0577);
	*wfdp = Fopen(dest, "wx.ufdio");
	umask(old_umask);
    }

    if (Ferror(*wfdp))
	rc = RPMERR_OPEN_FAILED;

    if (_fsm_debug) {
	rpmlog(RPMLOG_DEBUG, " %8s (%s [%d]) %s\n", __func__,
	       dest, Fileno(*wfdp), (rc < 0 ? strerror(errno) : ""));
    }

    if (rc)
	fsmClose(wfdp);

    return rc;
}