Get directory response code to work with full resource path
This commit is contained in:
parent
543858d01d
commit
5c21a0a8e2
8
main.c
8
main.c
@ -298,13 +298,13 @@ int main(int argc, char *argv[])
|
||||
* path must be null-terminated.
|
||||
*/
|
||||
namelen = strlen(ent->d_name);
|
||||
if (srvroot_len + namelen + 2 > PBUF_SIZE) {
|
||||
if (ppos + namelen + 2 > PBUF_SIZE) {
|
||||
fprintf(stderr, "Path buffer is too small\n");
|
||||
goto close_client_socket;
|
||||
}
|
||||
pbuf[srvroot_len] = '/';
|
||||
memcpy(&pbuf[srvroot_len + 1], ent->d_name, namelen);
|
||||
pbuf[srvroot_len + 1 + namelen] = '\0';
|
||||
pbuf[ppos] = '/';
|
||||
memcpy(&pbuf[ppos + 1], ent->d_name, namelen);
|
||||
pbuf[ppos + 1 + namelen] = '\0';
|
||||
|
||||
/*
|
||||
* Identify entry type from file inode information.
|
||||
|
Loading…
x
Reference in New Issue
Block a user