git.samba.org
/
tridge
/
junkcode.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
show all threads
[tridge/junkcode.git]
/
maxnamelen.c
1
#define _GNU_SOURCE
2
#include <string.h>
3
#include <stdlib.h>
4
#include <stdio.h>
5
#include <unistd.h>
6
#include <sys/types.h>
7
#include <sys/stat.h>
8
#include <fcntl.h>
9
#include <errno.h>
10
11
int main(void)
12
{
13
int i, fd;
14
15
for (i=1;i<1000;i++) {
16
char *fname;
17
fname = malloc(i+1);
18
memset(fname, 'X', i);
19
fname[i] = 0;
20
fd = open(fname, O_CREAT|O_EXCL|O_RDWR, 0644);
21
if (fd == -1) {
22
printf("failed at %d - %s\n", i, strerror(errno));
23
break;
24
}
25
close(fd);
26
unlink(fname);
27
}
28
29
return -1;
30
}