Revision | 5a7d064e16def73d3a3875d2cce84f26e72cf4ba (tree) |
---|---|
Time | 2016-10-05 22:53:37 |
Author | Koji Arai <jca02266@gmai...> |
Commiter | GitHub |
Merge pull request #9 from yoheie/fix_symlink_warning
Fix warning message on extracting symlink.
@@ -198,6 +198,23 @@ open_with_make_path(name) | ||
198 | 198 | } |
199 | 199 | |
200 | 200 | /* ------------------------------------------------------------------------ */ |
201 | +static int | |
202 | +symlink_with_make_path(realname, name) | |
203 | + const char *realname; | |
204 | + const char *name; | |
205 | +{ | |
206 | + int l_code; | |
207 | + | |
208 | + l_code = symlink(realname, name); | |
209 | + if (l_code < 0) { | |
210 | + make_parent_path(name); | |
211 | + l_code = symlink(realname, name); | |
212 | + } | |
213 | + | |
214 | + return l_code; | |
215 | +} | |
216 | + | |
217 | +/* ------------------------------------------------------------------------ */ | |
201 | 218 | static void |
202 | 219 | adjust_info(name, hdr) |
203 | 220 | char *name; |
@@ -509,8 +526,7 @@ extract_one(afp, hdr) | ||
509 | 526 | } |
510 | 527 | |
511 | 528 | unlink(name); |
512 | - make_parent_path(name); | |
513 | - l_code = symlink(hdr->realname, name); | |
529 | + l_code = symlink_with_make_path(hdr->realname, name); | |
514 | 530 | if (l_code < 0) { |
515 | 531 | if (quiet != TRUE) |
516 | 532 | warning("Can't make Symbolic Link \"%s\" -> \"%s\"", |