Check if the name is already used in add_debugger_command*() and reject
duplicate attempt(s). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40611 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -450,9 +450,12 @@ status_t
|
|||||||
add_debugger_command_etc(const char* name, debugger_command_hook func,
|
add_debugger_command_etc(const char* name, debugger_command_hook func,
|
||||||
const char* description, const char* usage, uint32 flags)
|
const char* description, const char* usage, uint32 flags)
|
||||||
{
|
{
|
||||||
struct debugger_command *cmd;
|
bool ambiguous;
|
||||||
|
debugger_command *cmd = find_debugger_command(name, false, ambiguous);
|
||||||
|
if (cmd != NULL && ambiguous == false)
|
||||||
|
return B_NAME_IN_USE;
|
||||||
|
|
||||||
cmd = (struct debugger_command*)malloc(sizeof(struct debugger_command));
|
cmd = (debugger_command*)malloc(sizeof(debugger_command));
|
||||||
if (cmd == NULL)
|
if (cmd == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user