Changeset aeeaf0f in mainline for uspace/app/bdsh/compl.c


Ignore:
Timestamp:
2019-05-19T07:28:42Z (5 years ago)
Author:
GitHub <noreply@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a78cdcd
Parents:
6aeb60f (diff), 587867a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jakub Jermář <jakub@…> (2019-05-19 07:28:42)
git-committer:
GitHub <noreply@…> (2019-05-19 07:28:42)
Message:

Merge pull request #163 from matthieuriolo/ticket_684_improved

Ticket 684 improved

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/compl.c

    r6aeb60f raeeaf0f  
    4040#include "exec.h"
    4141#include "tok.h"
     42#include "util.h"
    4243
    4344static errno_t compl_init(wchar_t *text, size_t pos, size_t *cstart, void **state);
     
    209210                }
    210211                *cstart += rpath_sep + 1 - prefix;
    211                 free(prefix);
    212                 prefix = NULL;
    213212
    214213                cs->path_list = malloc(sizeof(char *) * 2);
     
    217216                        goto error;
    218217                }
    219                 cs->path_list[0] = dirname;
     218
     219                if (!is_path(prefix) && cs->is_command) {
     220                        cs->path_list[0] = malloc(sizeof(char) * PATH_MAX);
     221                        if (cs->path_list[0] == NULL) {
     222                                retval = ENOMEM;
     223                                goto error;
     224                        }
     225
     226                        int ret = snprintf(cs->path_list[0], PATH_MAX, "%s/%s", search_dir[0], dirname);
     227                        if (ret < 0 || ret >= PATH_MAX) {
     228                                retval = ENOMEM;
     229                                goto error;
     230                        }
     231                } else {
     232                        cs->path_list[0] = dirname;
     233                }
     234
     235                free(prefix);
    220236                cs->path_list[1] = NULL;
    221237                /*
Note: See TracChangeset for help on using the changeset viewer.