- Fixed the type of the result from open and replace fclose with close.

- Call time with a parameter (WIN32).

svn path=/trunk/; revision=4820
This commit is contained in:
Hartmut Birr 2003-06-01 19:35:28 +00:00
parent 819f2750e9
commit d4ce775b60

View file

@ -42,7 +42,7 @@ char* convert_path(char* origpath)
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
char* path; char* path;
FILE* file; int id;
#ifdef WIN32 #ifdef WIN32
time_t now; time_t now;
struct utimbuf fnow; struct utimbuf fnow;
@ -55,21 +55,21 @@ int main(int argc, char* argv[])
} }
path = convert_path(argv[1]); path = convert_path(argv[1]);
file = (FILE *)open(path, S_IWRITE); id = open(path, S_IWRITE);
if (file == (void*)-1) if (id < 0)
{ {
file = (FILE *)open(path, S_IWRITE | O_CREAT); id = open(path, S_IWRITE | O_CREAT);
if (file == (void*)-1) if (id < 0)
{ {
fprintf(stderr, "Cannot create file.\n"); fprintf(stderr, "Cannot create file.\n");
exit(1); exit(1);
} }
} }
fclose(file); close(id);
#ifdef WIN32 #ifdef WIN32
now = time(); now = time(NULL);
fnow.actime = now; fnow.actime = now;
fnow.modtime = now; fnow.modtime = now;
(int) utime(path, &fnow); (int) utime(path, &fnow);