mirror of https://github.com/omar-polo/gmid.git
remame sendfile to send_file and senddir to send_dir
apparently, on some systems there is a sendfile(2), so to avoid a name clash we rename it to send_file and send_dir.
This commit is contained in:
parent
0d8ca45a28
commit
b55de91633
14
gmid.c
14
gmid.c
|
@ -169,10 +169,10 @@ isdir(int fd)
|
||||||
return S_ISDIR(sb.st_mode);
|
return S_ISDIR(sb.st_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void senddir(char*, struct tls*);
|
void send_dir(char*, struct tls*);
|
||||||
|
|
||||||
void
|
void
|
||||||
sendfile(char *path, struct tls *ctx)
|
send_file(char *path, struct tls *ctx)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
char fpath[PATHBUF];
|
char fpath[PATHBUF];
|
||||||
|
@ -196,7 +196,7 @@ sendfile(char *path, struct tls *ctx)
|
||||||
if (isdir(fd)) {
|
if (isdir(fd)) {
|
||||||
warnx("%s is a directory, trying %s/index.gmi", fpath, fpath);
|
warnx("%s is a directory, trying %s/index.gmi", fpath, fpath);
|
||||||
close(fd);
|
close(fd);
|
||||||
senddir(fpath, ctx);
|
send_dir(fpath, ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ exit:
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
senddir(char *path, struct tls *ctx)
|
send_dir(char *path, struct tls *ctx)
|
||||||
{
|
{
|
||||||
char fpath[PATHBUF];
|
char fpath[PATHBUF];
|
||||||
size_t len;
|
size_t len;
|
||||||
|
@ -253,7 +253,7 @@ senddir(char *path, struct tls *ctx)
|
||||||
|
|
||||||
strlcat(fpath, "index.gmi", sizeof(fpath));
|
strlcat(fpath, "index.gmi", sizeof(fpath));
|
||||||
|
|
||||||
sendfile(fpath, ctx);
|
send_file(fpath, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -274,9 +274,9 @@ handle(char *url, struct tls *ctx)
|
||||||
fprintf(stderr, "requested path: %s\n", path);
|
fprintf(stderr, "requested path: %s\n", path);
|
||||||
|
|
||||||
if (path_isdir(path))
|
if (path_isdir(path))
|
||||||
senddir(path, ctx);
|
send_dir(path, ctx);
|
||||||
else
|
else
|
||||||
sendfile(path, ctx);
|
send_file(path, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Loading…
Reference in New Issue