X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=inline;f=direct%2Ftimothy_tests%2Fquick_tests%2Ftest_yaffs_mkdir_ENOTDIR.c;fp=direct%2Ftimothy_tests%2Fquick_tests%2Ftest_yaffs_mkdir_ENOTDIR.c;h=4b36abc6a7a29acfad70e3cffe4538a682b8b24c;hb=03704f115fc239e6a7df6eeb6da2716aec3318f8;hp=0000000000000000000000000000000000000000;hpb=74241853717ad90835c1a0fbeed21957eeab3078;p=yaffs2.git diff --git a/direct/timothy_tests/quick_tests/test_yaffs_mkdir_ENOTDIR.c b/direct/timothy_tests/quick_tests/test_yaffs_mkdir_ENOTDIR.c new file mode 100644 index 0000000..4b36abc --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_mkdir_ENOTDIR.c @@ -0,0 +1,47 @@ +/* + * YAFFS: Yet another FFS. A NAND-flash specific file system. + * + * Copyright (C) 2002-2010 Aleph One Ltd. + * for Toby Churchill Ltd and Brightstar Engineering + * + * Created by Timothy Manning + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include "test_yaffs_mkdir_ENOTDIR.h" + +static int output = -1; + +int test_yaffs_mkdir_ENOTDIR(void) +{ + int error_code = 0; + + + output = yaffs_mkdir("/non_existing_directory/new_directory/",O_CREAT | O_RDWR); + if (output < 0){ + error_code = yaffs_get_error(); + if (abs(error_code) == ENOTDIR){ + return 1; + } else { + print_message("different error than expected\n", 2); + return -1; + } + } else { + print_message("created a new directory on top of an non-existing directory (which is a bad thing)\n", 2); + return -1; + } +} + + +int test_yaffs_mkdir_ENOTDIR_clean(void) +{ + if (output >= 0){ + return yaffs_rmdir(DIR_PATH); + } else { + return 1; + } +} +