Changeset c56a3eb in mainline
- Timestamp:
 - 2019-03-02T15:22:12Z (7 years ago)
 - Branches:
 - lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
 - Children:
 - 1c481ee
 - Parents:
 - 951e451
 - git-author:
 - Matthieu Riolo <matthieu.riolo@…> (2018-12-29 18:28:21)
 - git-committer:
 - Matthieu Riolo <matthieu.riolo@…> (2019-03-02 15:22:12)
 - File:
 - 
      
- 1 edited
 
- 
          
  uspace/app/bdsh/exec.c (modified) (4 diffs)
 
 
Legend:
- Unmodified
 - Added
 - Removed
 
- 
      
uspace/app/bdsh/exec.c
r951e451 rc56a3eb 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 *); … … 74 71 static char *find_command(char *cmd) 75 72 { 76 size_t i;77 78 found = (char *)malloc(PATH_MAX);79 80 73 /* The user has specified a full or relative path, just give it back. */ 81 74 if (-1 != try_access(cmd)) { 82 return (char *) cmd;75 return str_dup(cmd); 83 76 } 84 77 78 char *found = (char *)malloc(PATH_MAX); 85 79 /* We now have n places to look for the command */ 80 size_t i; 86 81 for (i = 0; search_dir[i] != NULL; i++) { 87 82 memset(found, 0, PATH_MAX); … … 91 86 } 92 87 } 88 free(found); 93 89 94 90 /* We didn't find it, just give it back as-is. */ 95 return (char *) cmd;91 return str_dup(cmd); 96 92 } 97 93 … … 107 103 FILE *files[3]; 108 104 109 tmp = str_dup(find_command(cmd)); 110 free(found); 105 tmp = find_command(cmd); 111 106 112 107 files[0] = io->stdin;  
  Note:
 See   TracChangeset
 for help on using the changeset viewer.
  