[SSSD] [PATCH] GPO: Use sss_unique_file and close fd on failure
Pavel Březina
pbrezina at redhat.com
Tue Sep 1 09:28:32 UTC 2015
On 09/01/2015 11:19 AM, Jakub Hrozek wrote:
> On Wed, Aug 26, 2015 at 02:21:23PM +0200, Pavel Březina wrote:
>> On 08/18/2015 03:35 PM, Jakub Hrozek wrote:
>>> Hi,
>>>
>>> one more usage of sss_unique_file I forgot to send earlier.
>>
>> Nack.
>>
>>> ret = close(fd);
>>> + fd = -1;
>>> if (ret == -1) {
>>> ret = errno;
>>> DEBUG(SSSDBG_CRIT_FAILURE,
>>> @@ -369,12 +366,16 @@ static errno_t gpo_cache_store_file(const char *smb_path,
>>> goto done;
>>> }
>>
>> Please, move this close(fd) call to done part, so we close fd only there.
>>
>>>
>>> + ret = EOK;
>>> done:
>>> -
>>> if (ret != EOK) {
>>> DEBUG(SSSDBG_CRIT_FAILURE, "Error encountered: %d.\n", ret);
>>> }
>>
>> And when you are here, can you fix indentation in the debug statement above?
>>
>>>
>>> + if (fd != -1) {
>>> + close(fd);
>>> + }
>>> +
>>> talloc_free(tmp_ctx);
>>> return ret;
>>> }
>>> -- 2.4.3
>>>
>>>
>>>
>>> _______________________________________________
>>> sssd-devel mailing list
>>> sssd-devel at lists.fedorahosted.org
>>> https://lists.fedorahosted.org/mailman/listinfo/sssd-devel
>>>
>
> Please see the attached patch, does it look better to you?
Hi, yes. There is just an indentation error:
> + if (fd != -1) {
> + fret = close(fd);
> + if (fret == -1) {
> + fret = errno;
> + DEBUG(SSSDBG_CRIT_FAILURE,
> + "close failed [%d][%s].\n", fret, strerror(fret));
^^
> + }
> }
More information about the sssd-devel
mailing list