Changeset e62f8e3 in mainline
- Timestamp:
- 2019-06-23T17:43:50Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 46288ee
- Parents:
- 0d0f1a8
- Location:
- uspace/app/bdsh
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/config.h
r0d0f1a8 re62f8e3 42 42 #endif 43 43 44 /* define maximal nested aliases */ 45 #ifndef HUBS_MAX 46 #define HUBS_MAX 20 47 #endif 48 44 49 /* Used in many places */ 45 50 #define SMALL_BUFLEN 256 -
uspace/app/bdsh/input.c
r0d0f1a8 re62f8e3 86 86 * the handler 87 87 */ 88 static errno_t process_input_nohup(cliuser_t *usr, list_t *alias_hups) 89 { 88 static errno_t process_input_nohup(cliuser_t *usr, list_t *alias_hups, size_t count_executed_hups) 89 { 90 if (count_executed_hups >= HUBS_MAX) { 91 cli_error(CL_EFAIL, "%s: maximal alias hubs reached\n", PACKAGE_NAME); 92 return ELIMIT; 93 } 94 90 95 token_t *tokens_buf = calloc(WORD_MAX, sizeof(token_t)); 91 96 if (tokens_buf == NULL) … … 197 202 if (!find_alias_hup(data, alias_hups)) { 198 203 alias_hup_t *hup = (alias_hup_t *)calloc(1, sizeof(alias_hup_t)); 204 if (hup == NULL) { 205 cli_error(CL_EFAIL, "%s: cannot allocate alias structure\n", PACKAGE_NAME); 206 rc = ENOMEM; 207 goto finit; 208 } 209 199 210 hup->alias = data; 200 211 list_append(&hup->alias_hup_link, alias_hups); … … 202 213 char *oldLine = usr->line; 203 214 const size_t input_length = str_size(usr->line) - str_size(cmd[0]) + str_size(data->value) + 1; 204 usr->line = (char *)malloc(input_length * sizeof(char)); 215 usr->line = (char *)malloc(input_length); 216 if (usr->line == NULL) { 217 cli_error(CL_EFAIL, "%s: cannot allocate input structure\n", PACKAGE_NAME); 218 rc = ENOMEM; 219 goto finit; 220 } 221 205 222 usr->line[0] = '\0'; 206 223 … … 222 239 223 240 /* reprocess input after string replace */ 224 rc = process_input_nohup(usr, alias_hups );241 rc = process_input_nohup(usr, alias_hups, count_executed_hups + 1); 225 242 usr->line = oldLine; 226 243 goto finit; … … 287 304 list_initialize(&alias_hups); 288 305 289 errno_t rc = process_input_nohup(usr, &alias_hups );306 errno_t rc = process_input_nohup(usr, &alias_hups, 0); 290 307 291 308 list_foreach_safe(alias_hups, cur_link, next_link) {
Note:
See TracChangeset
for help on using the changeset viewer.