git: 67870816419a - stable/13 - makefs: remove CD9660MAXPATH #define

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Fri, 14 Apr 2023 12:52:53 UTC
The branch stable/13 has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=67870816419a35256d989874a6370a412fe92b7e

commit 67870816419a35256d989874a6370a412fe92b7e
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2023-03-31 16:57:15 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2023-04-14 12:10:37 +0000

    makefs: remove CD9660MAXPATH #define
    
    It was used only in constructing the host path that contains file
    content, which is not related to anything CD9660-specific.  PATH_MAX is
    the appropriate limit.  See OpenBSD commit 299d8950f319.
    
    Obtained from:  OpenBSD
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 2f11df63374d279238e4836125a81fa2c5234730)
---
 usr.sbin/makefs/cd9660.c              | 4 ++--
 usr.sbin/makefs/cd9660.h              | 2 --
 usr.sbin/makefs/cd9660/cd9660_write.c | 2 +-
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/usr.sbin/makefs/cd9660.c b/usr.sbin/makefs/cd9660.c
index 40b2488e99e5..4159e08c8210 100644
--- a/usr.sbin/makefs/cd9660.c
+++ b/usr.sbin/makefs/cd9660.c
@@ -1582,10 +1582,10 @@ cd9660_compute_full_filename(cd9660node *node, char *buf)
 {
 	int len;
 
-	len = CD9660MAXPATH + 1;
+	len = PATH_MAX;
 	len = snprintf(buf, len, "%s/%s/%s", node->node->root,
 	    node->node->path, node->node->name);
-	if (len > CD9660MAXPATH)
+	if (len >= PATH_MAX)
 		errx(EXIT_FAILURE, "Pathname too long.");
 }
 
diff --git a/usr.sbin/makefs/cd9660.h b/usr.sbin/makefs/cd9660.h
index d854429a24bf..80b49f86ecf8 100644
--- a/usr.sbin/makefs/cd9660.h
+++ b/usr.sbin/makefs/cd9660.h
@@ -65,8 +65,6 @@
 #define	INODE_WARNX(__x)
 #endif /* DEBUG */
 
-#define CD9660MAXPATH 4096
-
 #define ISO_STRING_FILTER_NONE = 0x00
 #define ISO_STRING_FILTER_DCHARS = 0x01
 #define ISO_STRING_FILTER_ACHARS = 0x02
diff --git a/usr.sbin/makefs/cd9660/cd9660_write.c b/usr.sbin/makefs/cd9660/cd9660_write.c
index c77ba2b5f198..6716c2f98704 100644
--- a/usr.sbin/makefs/cd9660/cd9660_write.c
+++ b/usr.sbin/makefs/cd9660/cd9660_write.c
@@ -273,7 +273,7 @@ cd9660_write_file(iso9660_disk *diskStructure, FILE *fd, cd9660node *writenode)
 
 	/* Todo : clean up variables */
 
-	temp_file_name = ecalloc(CD9660MAXPATH + 1, 1);
+	temp_file_name = ecalloc(PATH_MAX, 1);
 	buf = emalloc(diskStructure->sectorSize);
 	if ((writenode->level != 0) &&
 	    !(writenode->node->type & S_IFDIR)) {