]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
man/man3/opendir.3: ERRORS: Document that long file names result in ENAMETOOLONG
authorCollin Funk <collin.funk1@gmail.com>
Fri, 17 Oct 2025 08:18:43 +0000 (01:18 -0700)
committerAlejandro Colomar <alx@kernel.org>
Tue, 28 Oct 2025 23:35:14 +0000 (00:35 +0100)
This behavior can be seen with the following example program:

$ cat main.c
#include <dirent.h>
#include <err.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>

int
main(int argc, char *argv[argc+1])
{
DIR  *d;

if (argc < 2)
errx(EXIT_FAILURE, "argc < 2");

d = opendir(argv[1]);
if (d == NULL)
err(EXIT_FAILURE, "opendir");

closedir(d);
exit(EXIT_SUCCESS);
}
$ cc -Wall -Wextra main.c
$ ./a.out $(printf '%0999d')
a.out: opendir: File name too long

Signed-off-by: Collin Funk <collin.funk1@gmail.com>
Message-ID: <4266061219d7406c0aa737f8d52108fea7e0f7fb.1760689006.git.collin.funk1@gmail.com>
[jwilk: simpler reproducer]
Cc: Jakub Wilk <jwilk@jwilk.net>
[alx: Fix style in the reproducer program]
Signed-off-by: Alejandro Colomar <alx@kernel.org>
man/man3/opendir.3

index a9af162690923f77413d8ef7571dace5a36e853c..6a5c7880f20cf5ea9828f47593ff17453415885f 100644 (file)
@@ -73,6 +73,10 @@ is not a valid file descriptor opened for reading.
 .B EMFILE
 The per-process limit on the number of open file descriptors has been reached.
 .TP
+.B ENAMETOOLONG
+.I name
+was too long.
+.TP
 .B ENFILE
 The system-wide limit on the total number of open files has been reached.
 .TP