Changeset 2de05dd in rtems


Ignore:
Timestamp:
Nov 21, 2019, 9:27:16 AM (13 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5, master
Children:
273e8b7
Parents:
b6f66d9
git-author:
Sebastian Huber <sebastian.huber@…> (11/21/19 09:27:16)
git-committer:
Sebastian Huber <sebastian.huber@…> (11/25/19 10:32:19)
Message:

untar: Make path also for symbolic links

Close #3823.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libmisc/untar/untar.c

    rb6f66d9 r2de05dd  
    124124 */
    125125static int
    126 Make_Path(const rtems_printer *printer, const char* filename, bool end_is_dir)
     126Make_Path(const rtems_printer *printer, const char* filename, int linktype)
    127127{
    128128  char* copy = strdup(filename);
     
    217217        }
    218218      }
    219       else if (path_end && r == DIRTYPE && !end_is_dir) {
     219      else if (path_end && r == DIRTYPE && linktype != DIRTYPE) {
    220220        /*
    221221         * We only handle a directory if at the end of the path and the end is
     
    290290   * with it.
    291291   */
     292
     293  if (Make_Path(ctx->printer, ctx->file_path, ctx->linkflag) < 0) {
     294    retval = UNTAR_FAIL;
     295  }
     296
    292297  if (ctx->linkflag == SYMTYPE) {
    293298    strlcpy(ctx->link_name, &bufr[157], sizeof(ctx->link_name));
     
    299304                 ctx->file_path, ctx->file_size, ctx->mode);
    300305    ctx->nblocks = (((ctx->file_size) + 511) & ~511) / 512;
    301     if (Make_Path(ctx->printer, ctx->file_path, false) < 0) {
    302       retval  = UNTAR_FAIL;
    303     }
    304306  } else if (ctx->linkflag == DIRTYPE) {
    305307    int r;
    306     rtems_printf(ctx->printer, "untar:  dir: %s\n", ctx->file_path);
    307     if (Make_Path(ctx->printer, ctx->file_path, true) < 0) {
    308       retval  = UNTAR_FAIL;
    309     }
     308    rtems_printf(ctx->printer, "untar: dir: %s\n", ctx->file_path);
    310309    r = mkdir(ctx->file_path, S_IRWXU | S_IRWXG | S_IRWXO);
    311310    if (r < 0) {
Note: See TracChangeset for help on using the changeset viewer.