Changeset ba6232b in mainline
- Timestamp:
- 2009-07-15T20:11:04Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- aa7954f
- Parents:
- bf5443d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/util.c
rbf5443d rba6232b 54 54 unsigned int cli_set_prompt(cliuser_t *usr) 55 55 { 56 usr->prompt = (char *) realloc(usr->prompt, PATH_MAX);57 if (NULL == usr->prompt) {58 cli_error(CL_ENOMEM, "Can not allocate prompt");59 cli_errno = CL_ENOMEM;60 return 1;61 }62 memset(usr->prompt, 0, sizeof(usr->prompt));63 64 56 usr->cwd = (char *) realloc(usr->cwd, PATH_MAX); 65 57 if (NULL == usr->cwd) { … … 68 60 return 1; 69 61 } 70 memset(usr->cwd, 0, sizeof(usr->cwd)); 71 72 usr->cwd = getcwd(usr->cwd, PATH_MAX - 1); 73 74 if (NULL == usr->cwd) 62 if (!getcwd(usr->cwd, PATH_MAX)) 75 63 snprintf(usr->cwd, PATH_MAX, "(unknown)"); 76 64 65 if (usr->prompt) 66 free(usr->prompt); 77 67 asprintf(&usr->prompt, "%s # ", usr->cwd); 78 68
Note:
See TracChangeset
for help on using the changeset viewer.