Changeset e70f1ae in mainline
- Timestamp:
- 2018-12-29T20:09:49Z (6 years ago)
- Parents:
- 96e9434
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/exec.c
r96e9434 re70f1ae 66 66 67 67 /** Returns the full path of "cmd" if cmd is found 68 * 69 * else just hand back cmd as it was presented 68 * or null if the cmd cannot be found 70 69 */ 71 70 static char *find_command(char *cmd) … … 74 73 75 74 /* The user has specified a full or relative path, just give it back. */ 76 if (-1 != try_access(cmd)) { 77 return str_dup(cmd); 75 size_t len = str_length(cmd); 76 if ((len > 1 && cmd[0] == '/') || (len > 2 && cmd[0] == '.' && cmd[1] == '/')) { 77 if (-1 != try_access(cmd)) { 78 return str_dup(cmd); 79 } 78 80 } 79 81 … … 89 91 free(found); 90 92 91 /* We didn't find it, just give it back as-is.*/92 return str_dup(cmd);93 /* We didn't find it, return NULL */ 94 return NULL; 93 95 } 94 96 … … 105 107 106 108 tmp = find_command(cmd); 109 if (tmp == NULL) { 110 cli_error(CL_EEXEC, "%s: Command not found '%s'", progname, cmd); 111 return 1; 112 } 107 113 108 114 files[0] = io->stdin;
Note:
See TracChangeset
for help on using the changeset viewer.