Fix copyright
[yaffs2.git] / direct / test-framework / timothy_tests / yaffs_and_linux_mirror_tests / linux_test_open.c
1 /*
2  * YAFFS: Yet another FFS. A NAND-flash specific file system.
3  *
4  * Copyright (C) 2002-2018 Aleph One Ltd.
5  *
6  * Created by Timothy Manning <timothy@yaffs.net>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software Foundation.
11  */
12
13 #include "linux_test_open.h"
14
15 int linux_test_open(arg_temp *args_struct)
16 {
17         char path[250];
18         char message[150];
19         int output;
20         join_paths(linux_struct.root_path,args_struct->string1, path );
21         sprintf(message,"file path: %s\n",path);        
22         print_message(3,message);
23
24         output= open(path,args_struct->char1 & (O_TRUNC|O_EXCL|O_CREAT|O_APPEND) ,args_struct->char2& (S_IREAD|S_IWRITE));
25         if (output>=0){
26                 output=close(output);
27                 if (output<0) {
28                         print_message(3,"failed to close handle\n");
29                         return -1;
30                 } else {
31                         return 1;
32                 }
33         } else {
34                 print_message(3,"failed to open file\n");
35                 return -1;
36         }
37 }