groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 01/01: On systems without NAME_MAX, use FILENAME_MAX as a last r


From: Ingo Schwarze
Subject: [groff] 01/01: On systems without NAME_MAX, use FILENAME_MAX as a last resort.
Date: Wed, 21 Oct 2020 18:30:57 -0400 (EDT)

schwarze pushed a commit to branch master
in repository groff.

commit 9c5f9a862a7522665d9f84e38d86aef5e588e879
Author: Ingo Schwarze <schwarze@openbsd.org>
AuthorDate: Wed Oct 21 18:31:24 2020 +0200

    On systems without NAME_MAX, use FILENAME_MAX as a last resort.
    
    Problem reported by Eli Zaretskii <eliz at gnu dot org>
    on MS Windows in https://savannah.gnu.org/bugs/?55449
    OK gbranden@ eliz@
---
 ChangeLog                         |  7 +++++++
 src/libs/libgroff/maxfilename.cpp | 21 ++++++++++++++++-----
 2 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d9ccebc..59ce322 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2020-10-21  Ingo Schwarze <schwarze@openbsd.org>
+
+       On systems without NAME_MAX, use FILENAME_MAX as a last resort.
+
+       Problem reported by Eli Zaretskii <eliz at gnu dot org>
+       on MS Windows in https://savannah.gnu.org/bugs/?55449
+
 2020-10-20  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/roff/troff/env.cpp (environment::possibly_break_line):
diff --git a/src/libs/libgroff/maxfilename.cpp 
b/src/libs/libgroff/maxfilename.cpp
index 777f82c..009b45d 100644
--- a/src/libs/libgroff/maxfilename.cpp
+++ b/src/libs/libgroff/maxfilename.cpp
@@ -47,14 +47,25 @@ size_t file_name_max(const char *fname)
 #ifndef NAME_MAX
 #ifdef MAXNAMLEN
 #define NAME_MAX MAXNAMLEN
-#else /* !MAXNAMLEN */
+#endif
+#endif
+
+#ifndef NAME_MAX
 #ifdef MAXNAMELEN
 #define NAME_MAX MAXNAMELEN
-#else /* !MAXNAMELEN */
+#endif
+#endif
+
+#ifndef NAME_MAX
+#include <stdio.h>
+#ifdef FILENAME_MAX
+#define NAME_MAX FILENAME_MAX
+#endif
+#endif
+
+#ifndef NAME_MAX
 #define NAME_MAX 14
-#endif /* !MAXNAMELEN */
-#endif /* !MAXNAMLEN */
-#endif /* !NAME_MAX */
+#endif
 
 size_t file_name_max(const char *)
 {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]