Fixed warnings.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6298 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -184,8 +184,8 @@ int main(int argc,char **argv)
|
|||||||
printf("You can either create a test file or perform the test.\n"
|
printf("You can either create a test file or perform the test.\n"
|
||||||
" Create:\t%s create [filesize]\n"
|
" Create:\t%s create [filesize]\n"
|
||||||
" Test: \t%s [loops]\n\n"
|
" Test: \t%s [loops]\n\n"
|
||||||
"Default size = %ld, loops = %ld\n",
|
"Default size = %d, loops = %d\n",
|
||||||
filename,filename,FILE_SIZE,NUMBER_OF_LOOPS);
|
filename, filename, FILE_SIZE, NUMBER_OF_LOOPS);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
int main(int argc,char **argv)
|
int
|
||||||
|
main(int argc,char **argv)
|
||||||
{
|
{
|
||||||
int file;
|
int file;
|
||||||
|
|
||||||
@@ -14,34 +16,34 @@ int main(int argc,char **argv)
|
|||||||
remove("__directory");
|
remove("__directory");
|
||||||
remove("__file");
|
remove("__file");
|
||||||
|
|
||||||
file = open("__file",O_CREAT | O_TRUNC | O_WRONLY);
|
file = open("__file", O_CREAT | O_TRUNC | O_WRONLY);
|
||||||
if (file < 0)
|
if (file < 0)
|
||||||
return -1;
|
return -1;
|
||||||
close(file);
|
close(file);
|
||||||
|
|
||||||
if (chmod("__file",0644) != 0)
|
if (chmod("__file", 0644) != 0)
|
||||||
printf("chmod fails: %s\n",strerror(errno));
|
printf("chmod fails: %s\n", strerror(errno));
|
||||||
|
|
||||||
if (mkdir("__directory",0755) != 0)
|
if (mkdir("__directory", 0755) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// create a file in that directory
|
// create a file in that directory
|
||||||
file = open("__directory/1",O_CREAT | O_WRONLY);
|
file = open("__directory/1", O_CREAT | O_WRONLY);
|
||||||
close(file);
|
close(file);
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
|
||||||
puts("rename test: Overwrite a directory with files in it");
|
puts("rename test: Overwrite a directory with files in it");
|
||||||
printf(" %s\n",rename("__file","__directory") ? "Could not rename file!" : "Rename succeeded.");
|
printf(" %s\n",rename("__file", "__directory") ? "Could not rename file!" : "Rename succeeded.");
|
||||||
printf(" errno = %d (%s)\n",errno,strerror(errno));
|
printf(" errno = %d (%s)\n", errno, strerror(errno));
|
||||||
|
|
||||||
remove("__directory/1");
|
remove("__directory/1");
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
|
||||||
// rename the file and try to remove the directory
|
// rename the file and try to remove the directory
|
||||||
puts("rename test: Overwrite an empty directory");
|
puts("rename test: Overwrite an empty directory");
|
||||||
printf(" %s\n",rename("__file","__directory") ? "Could not rename file!" : "Rename succeeded.");
|
printf(" %s\n", rename("__file","__directory") ? "Could not rename file!" : "Rename succeeded.");
|
||||||
printf(" errno = %d (%s)\n",errno,strerror(errno));
|
printf(" errno = %d (%s)\n", errno, strerror(errno));
|
||||||
|
|
||||||
remove("__directory");
|
remove("__directory");
|
||||||
remove("__file");
|
remove("__file");
|
||||||
|
|||||||
Reference in New Issue
Block a user