[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #55449] [PATCH] Use FILENAME_MAX in maxfilename.cpp
From: |
Ingo Schwarze |
Subject: |
[bug #55449] [PATCH] Use FILENAME_MAX in maxfilename.cpp |
Date: |
Wed, 21 Oct 2020 12:43:27 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; OpenBSD amd64; rv:81.0) Gecko/20100101 Firefox/81.0 |
Update of bug #55449 (project groff):
Assigned to: None => schwarze
Planned Release: None => 1.23
_______________________________________________________
Follow-up Comment #4:
The patch #45943 is not correct.
According to the comment at the top of src/libs/libgroff/maxfilename.cpp, what
the function file_name_max() wants to return is NAME_MAX.
If a system defines both NAME_MAX and FILENAME_MAX - which all system ought to
do because POSIX requires both - then the patch clobbers NAME_MAX with
FILENAME_MAX. On some systems, both have different values.
I also suggest to use a more readable idiom avoiding nested #ifs, see the
attached patch 55449-schwarze.patch.
Also, use FILENAME_MAX only as a last-resort fallback. It is not clear to me
that FILENAME_MAX has exactly the same meaning as NAME_MAX. On some systems,
FILENAME_MAX is much larger than NAME_MAX, so using it does not seem perfectly
safe. Then again, when nothing else is available, maybe it is still better
than 14.
Eli, can you test whether this version works for you, too?
(file #50036)
_______________________________________________________
Additional Item Attachment:
File name: 55449-schwarze.patch Size:1 KB
<https://file.savannah.gnu.org/file/55449-schwarze.patch?file_id=50036>
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?55449>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [bug #55449] [PATCH] Use FILENAME_MAX in maxfilename.cpp, Dave, 2020/10/13
- [bug #55449] [PATCH] Use FILENAME_MAX in maxfilename.cpp, G. Branden Robinson, 2020/10/21
- [bug #55449] [PATCH] Use FILENAME_MAX in maxfilename.cpp, Eli Zaretskii, 2020/10/21
- Re: [bug #55449] [PATCH] Use FILENAME_MAX in maxfilename.cpp, Carsten Kunze, 2020/10/21
- Re: [bug #55449] [PATCH] Use FILENAME_MAX in maxfilename.cpp, Carsten Kunze, 2020/10/21
- Re: [bug #55449] [PATCH] Use FILENAME_MAX in maxfilename.cpp, Ingo Schwarze, 2020/10/21
- Re: [bug #55449] [PATCH] Use FILENAME_MAX in maxfilename.cpp, Steffen Nurpmeso, 2020/10/21