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