diff --git a/src/error.h b/src/error.h index a69e177..020cdd0 100644 --- a/src/error.h +++ b/src/error.h @@ -13,30 +13,30 @@ * TODO #00003 make this header public */ -#define ISO_SUCCESS 1 -#define ISO_ERROR -1 -#define ISO_NULL_POINTER -2 -#define ISO_OUT_OF_MEM -3 -#define ISO_MEM_ERROR -4 -#define ISO_INTERRUPTED -5 -#define ISO_WRONG_ARG_VALUE -6 +#define ISO_SUCCESS 1 +#define ISO_ERROR -1 +#define ISO_NULL_POINTER -2 +#define ISO_OUT_OF_MEM -3 +#define ISO_MEM_ERROR -4 +#define ISO_INTERRUPTED -5 +#define ISO_WRONG_ARG_VALUE -6 -#define ISO_WRITE_ERROR -10 +#define ISO_WRITE_ERROR -10 #define ISO_NODE_ALREADY_ADDED -50 #define ISO_NODE_NAME_NOT_UNIQUE -51 #define ISO_NODE_NOT_ADDED_TO_DIR -52 -#define ISO_FILE_ERROR -100 -#define ISO_FILE_ALREADY_OPENNED -101 -#define ISO_FILE_ACCESS_DENIED -102 -#define ISO_FILE_BAD_PATH -103 -#define ISO_FILE_DOESNT_EXIST -104 -#define ISO_FILE_NOT_OPENNED -105 -#define ISO_FILE_IS_DIR -106 -#define ISO_FILE_READ_ERROR -107 -#define ISO_FILE_IS_NOT_DIR -108 -#define ISO_FILE_IS_NOT_SYMLINK -109 +#define ISO_FILE_ERROR -100 +#define ISO_FILE_ALREADY_OPENNED -101 +#define ISO_FILE_ACCESS_DENIED -102 +#define ISO_FILE_BAD_PATH -103 +#define ISO_FILE_DOESNT_EXIST -104 +#define ISO_FILE_NOT_OPENNED -105 +#define ISO_FILE_IS_DIR -106 +#define ISO_FILE_READ_ERROR -107 +#define ISO_FILE_IS_NOT_DIR -108 +#define ISO_FILE_IS_NOT_SYMLINK -109 #define ISO_FILE_TOO_BIG -110 #define ISO_CHARSET_CONV_ERROR -150 diff --git a/src/node.c b/src/node.c index 44f27e0..7ee11c6 100644 --- a/src/node.c +++ b/src/node.c @@ -85,6 +85,10 @@ int iso_node_set_name(IsoNode *node, const char *name) return ISO_NODE_NAME_NOT_UNIQUE; } } + /* guard against the empty string */ + if (name[0] == '\0') { + return ISO_WRONG_ARG_VALUE; + } new = strdup(name); if (new == NULL) { return ISO_MEM_ERROR;