Changeset 96e9434 in mainline
- Timestamp:
- 2018-12-29T18:28:21Z (6 years ago)
- Children:
- e70f1ae
- Parents:
- accdbd8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/exec.c
raccdbd8 r96e9434 47 47 #include "errors.h" 48 48 49 /* FIXME: Just have find_command() return an allocated string */50 static char *found;51 52 49 static char *find_command(char *); 53 50 static int try_access(const char *); … … 76 73 size_t i; 77 74 78 found = (char *)malloc(PATH_MAX);79 80 75 /* The user has specified a full or relative path, just give it back. */ 81 76 if (-1 != try_access(cmd)) { 82 return (char *) cmd;77 return str_dup(cmd); 83 78 } 84 79 80 char *found = (char *)malloc(PATH_MAX); 85 81 /* We now have n places to look for the command */ 86 82 for (i = 0; search_dir[i] != NULL; i++) { … … 91 87 } 92 88 } 89 free(found); 93 90 94 91 /* We didn't find it, just give it back as-is. */ 95 return (char *) cmd;92 return str_dup(cmd); 96 93 } 97 94 … … 107 104 FILE *files[3]; 108 105 109 tmp = str_dup(find_command(cmd)); 110 free(found); 106 tmp = find_command(cmd); 111 107 112 108 files[0] = io->stdin;
Note:
See TracChangeset
for help on using the changeset viewer.