Ignore:
Timestamp:
2019-06-26T17:51:50Z (6 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b781cc49
Parents:
e62f8e3
Message:

Improvement alias/unlias according to feedback

This commit will change the behaviour of unalias
when a not existing aliasname is given. The command
will newly return CMD_FAILURE and print a failure message.
Existings aliases will be deleted.

When updating an existing alias with the command alias,
then the old data structure will only be freed when
str_dup did not fail. This will prevent the data
of being corrupted in case of a memory failure.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/cmds/modules/unalias/unalias.c

    re62f8e3 r46288ee  
    9292        }
    9393
     94        int rc = CMD_SUCCESS;
    9495        size_t i;
    9596        for (i = 1; argv[i] != NULL; i++) {
     
    9899                if (alias_link == NULL) {
    99100                        cli_error(CL_ENOENT, "%s: No alias '%s' found\n", cmdname, argv[i]);
     101                        rc = CMD_FAILURE;
    100102                } else {
    101103                        free_alias(alias_link);
     
    103105        }
    104106
    105         return CMD_SUCCESS;
     107        return rc;
    106108}
Note: See TracChangeset for help on using the changeset viewer.