375 |
|
|
376 |
copy_stream(source, destination); |
copy_stream(source, destination); |
377 |
|
|
378 |
|
#ifndef _WIN32 |
379 |
|
/* copy permissions */ |
380 |
|
struct stat buf; |
381 |
|
if (fstat(fileno(source), &buf) == -1) { |
382 |
|
fatal("cannot stat file: %s", source_file); |
383 |
|
} |
384 |
|
fchmod(fileno(destination), buf.st_mode); |
385 |
|
#endif |
386 |
|
|
387 |
fclose(source); |
fclose(source); |
388 |
fclose(destination); |
fclose(destination); |
389 |
} |
} |
426 |
head = recursive_dir_list(root, entry_wrt_root, head); |
head = recursive_dir_list(root, entry_wrt_root, head); |
427 |
free(entry_wrt_root); |
free(entry_wrt_root); |
428 |
} |
} |
429 |
|
else if (S_ISLNK(buf.st_mode)) { |
430 |
|
/* check what it points to */ |
431 |
|
xstat(entry, &buf); |
432 |
|
if (S_ISREG(buf.st_mode)) { |
433 |
|
struct DirListEntry * p = xmalloc(sizeof(struct DirListEntry)); |
434 |
|
p->name = entry_wrt_root; |
435 |
|
p->next = head; |
436 |
|
head = p; |
437 |
|
} |
438 |
|
else { |
439 |
|
fatal("refusing to follow symbolic link: %s", entry); |
440 |
|
} |
441 |
|
} |
442 |
else { |
else { |
443 |
fatal("unknown file type: %s", entry); |
fatal("unknown file type: %s", entry); |
444 |
} |
} |