qfile-agent: Handle filenames with trailing slash properly.
This commit is contained in:
parent
e6da61cb5e
commit
5230c12934
@ -57,13 +57,13 @@ int single_file_processor(char *filename, struct stat *st)
|
||||
hdr.mtime_nsec = st->st_mtim.tv_nsec;
|
||||
|
||||
if (S_ISREG(mode)) {
|
||||
char * ret;
|
||||
char *ret;
|
||||
fd = open(filename, O_RDONLY);
|
||||
if (!fd)
|
||||
gui_fatal("open %s", filename);
|
||||
hdr.filelen = st->st_size;
|
||||
write_headers(&hdr, filename);
|
||||
ret=copy_file(1, fd, hdr.filelen);
|
||||
ret = copy_file(1, fd, hdr.filelen);
|
||||
if (ret)
|
||||
gui_fatal("Copying file %s: %s", filename, ret);
|
||||
close(fd);
|
||||
@ -142,10 +142,13 @@ void parse_entry(char *data, int datasize)
|
||||
notify_progress(0, 1);
|
||||
send_vmname(vmname);
|
||||
while ((entry = get_item(data, ¤t, datasize))) {
|
||||
do {
|
||||
sep = rindex(entry, '/');
|
||||
if (!sep)
|
||||
gui_fatal("Internal error: nonabsolute filenames not allowed");
|
||||
gui_fatal
|
||||
("Internal error: nonabsolute filenames not allowed");
|
||||
*sep = 0;
|
||||
} while (sep[1] == 0);
|
||||
if (entry[0] == 0)
|
||||
chdir("/");
|
||||
else if (chdir(entry))
|
||||
|
Loading…
Reference in New Issue
Block a user