version 1.4, 2019/12/16 16:09:28 |
version 1.5, 2019/12/16 16:39:03 |
|
|
|
|
RB_GENERATE(client_files, client_file, entry, file_cmp); |
RB_GENERATE(client_files, client_file, entry, file_cmp); |
|
|
|
static char * |
|
file_get_path(struct client *c, const char *file) |
|
{ |
|
char *path; |
|
|
|
if (*file == '/') |
|
path = xstrdup(file); |
|
else |
|
xasprintf(&path, "%s/%s", server_client_get_cwd(c, NULL), file); |
|
return (path); |
|
} |
|
|
int |
int |
file_cmp(struct client_file *cf1, struct client_file *cf2) |
file_cmp(struct client_file *cf1, struct client_file *cf2) |
{ |
{ |
|
|
} |
} |
|
|
cf = file_create(c, file_next_stream++, cb, cbdata); |
cf = file_create(c, file_next_stream++, cb, cbdata); |
cf->path = server_client_get_path(c, path); |
cf->path = file_get_path(c, path); |
|
|
if (c == NULL || c->flags & CLIENT_ATTACHED) { |
if (c == NULL || c->flags & CLIENT_ATTACHED) { |
if (flags & O_APPEND) |
if (flags & O_APPEND) |
|
|
} |
} |
|
|
cf = file_create(c, file_next_stream++, cb, cbdata); |
cf = file_create(c, file_next_stream++, cb, cbdata); |
cf->path = server_client_get_path(c, path); |
cf->path = file_get_path(c, path); |
|
|
if (c == NULL || c->flags & CLIENT_ATTACHED) { |
if (c == NULL || c->flags & CLIENT_ATTACHED) { |
f = fopen(cf->path, "rb"); |
f = fopen(cf->path, "rb"); |