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:
Omar Polo 2020-10-03 12:43:34 +02:00
parent 0d8ca45a28
commit b55de91633
No known key found for this signature in database
GPG Key ID: 35F98C96A1786F0D
1 changed files with 7 additions and 7 deletions

14
gmid.c
View File

@ -169,10 +169,10 @@ isdir(int fd)
return S_ISDIR(sb.st_mode);
}
void senddir(char*, struct tls*);
void send_dir(char*, struct tls*);
void
sendfile(char *path, struct tls *ctx)
send_file(char *path, struct tls *ctx)
{
int fd;
char fpath[PATHBUF];
@ -196,7 +196,7 @@ sendfile(char *path, struct tls *ctx)
if (isdir(fd)) {
warnx("%s is a directory, trying %s/index.gmi", fpath, fpath);
close(fd);
senddir(fpath, ctx);
send_dir(fpath, ctx);
return;
}
@ -232,7 +232,7 @@ exit:
}
void
senddir(char *path, struct tls *ctx)
send_dir(char *path, struct tls *ctx)
{
char fpath[PATHBUF];
size_t len;
@ -253,7 +253,7 @@ senddir(char *path, struct tls *ctx)
strlcat(fpath, "index.gmi", sizeof(fpath));
sendfile(fpath, ctx);
send_file(fpath, ctx);
}
void
@ -274,9 +274,9 @@ handle(char *url, struct tls *ctx)
fprintf(stderr, "requested path: %s\n", path);
if (path_isdir(path))
senddir(path, ctx);
send_dir(path, ctx);
else
sendfile(path, ctx);
send_file(path, ctx);
}
int