Re: BUG #15858: could not stat file - over 4GB

Поиск
Список
Период
Сортировка
От Juan José Santamaría Flecha
Тема Re: BUG #15858: could not stat file - over 4GB
Дата
Msg-id CAC+AXB0f-pGWb2Rx1amCRCpjKohKLQ4L+Vsy7JaeHVgwJgbnGA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #15858: could not stat file - over 4GB  (Michael Paquier <michael@paquier.xyz>)
Ответы Re: BUG #15858: could not stat file - over 4GB  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Sat, Oct 10, 2020 at 2:24 PM Michael Paquier <michael@paquier.xyz> wrote:

-               _dosmaperr(GetLastError());
+               DWORD           err = GetLastError();
+
+               /* report when not ERROR_SUCCESS */
+               if (err == ERROR_FILE_NOT_FOUND || err == ERROR_PATH_NOT_FOUND)
+                       errno = ENOENT;
+               else
+                       _dosmaperr(err);
Why are you changing that?  The original coding is fine, as
_dosmaperr() already maps ERROR_FILE_NOT_FOUND and
ERROR_PATH_NOT_FOUND to ENOENT.

If the file does not exist there is no need to call _dosmaperr() and log the error. 

-      _dosmaperr(GetLastError());
+      DWORD           err = GetLastError();
+
       CloseHandle(hFile);
+      _dosmaperr(err);
These parts are indeed incorrect.  CloseHandle() could overwrite
errno.

The meaningful error should come from the previous call, and an error from CloseHandle() could mask it. Not sure it makes a difference anyhow.

Regards,

Juan José Santamaría Flecha

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: BUG #15858: could not stat file - over 4GB
Следующее
От: Andrey Borodin
Дата:
Сообщение: Re: Batching page logging during B-tree build