git: 2f11df63374d - main - makefs: remove CD9660MAXPATH #define
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 05 Apr 2023 18:07:30 UTC
The branch main has been updated by emaste:
URL: https://cgit.FreeBSD.org/src/commit/?id=2f11df63374d279238e4836125a81fa2c5234730
commit 2f11df63374d279238e4836125a81fa2c5234730
Author: Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2023-03-31 16:57:15 +0000
Commit: Ed Maste <emaste@FreeBSD.org>
CommitDate: 2023-04-05 18:05:49 +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
---
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)) {