Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
d8e98d3a
Commit
d8e98d3a
authored
Dec 30, 2003
by
Ferenc Wagner
Committed by
Alexandre Julliard
Dec 30, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix undeleted temporary file.
Correct error messages and comments, break long lines.
parent
610e89ec
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
16 deletions
+31
-16
file.c
dlls/msvcrt/tests/file.c
+31
-16
No files found.
dlls/msvcrt/tests/file.c
View file @
d8e98d3a
...
...
@@ -185,35 +185,50 @@ static void test_file_write_read( void )
char
btext
[
LLEN
];
tempf
=
_tempnam
(
"."
,
"wne"
);
ok
((
tempfd
=
_open
(
tempf
,
_O_CREAT
|
_O_TRUNC
|
_O_TEXT
|
_O_RDWR
,
_S_IREAD
|
_S_IWRITE
))
!=
-
1
,
"Can't open"
);
/* open in TEXT mode */
ok
(
_write
(
tempfd
,
mytext
,
strlen
(
mytext
))
==
lstrlenA
(
mytext
),
"_write _O_TEXT bad return value"
);
ok
((
tempfd
=
_open
(
tempf
,
_O_CREAT
|
_O_TRUNC
|
_O_TEXT
|
_O_RDWR
,
_S_IREAD
|
_S_IWRITE
))
!=
-
1
,
"Can't open '%s': %d"
,
tempf
,
errno
);
/* open in TEXT mode */
ok
(
_write
(
tempfd
,
mytext
,
strlen
(
mytext
))
==
lstrlenA
(
mytext
),
"_write _O_TEXT bad return value"
);
_close
(
tempfd
);
tempfd
=
_open
(
tempf
,
_O_RDONLY
|
_O_BINARY
,
0
);
/* open in BINARY mode */
ok
(
_read
(
tempfd
,
btext
,
LLEN
)
==
lstrlenA
(
dostext
),
"_read _O_BINARY got bad length"
);
ok
(
memcmp
(
dostext
,
btext
,
strlen
(
dostext
))
==
0
,
"problems with _O_TEXT _write and _O_BINARY _write"
);
ok
(
btext
[
strlen
(
dostext
)
-
2
]
==
'\r'
,
"CR not written"
);
ok
(
_read
(
tempfd
,
btext
,
LLEN
)
==
lstrlenA
(
dostext
),
"_read _O_BINARY got bad length"
);
ok
(
memcmp
(
dostext
,
btext
,
strlen
(
dostext
))
==
0
,
"problems with _O_TEXT _write / _O_BINARY _read"
);
ok
(
btext
[
strlen
(
dostext
)
-
2
]
==
'\r'
,
"CR not written or read"
);
_close
(
tempfd
);
tempfd
=
_open
(
tempf
,
_O_RDONLY
|
_O_TEXT
);
/* open in TEXT mode */
ok
(
_read
(
tempfd
,
btext
,
LLEN
)
==
lstrlenA
(
mytext
),
"_read _O_TEXT got bad length"
);
ok
(
memcmp
(
mytext
,
btext
,
strlen
(
mytext
))
==
0
,
"problems with _O_TEXT _write / _write"
);
ok
(
_read
(
tempfd
,
btext
,
LLEN
)
==
lstrlenA
(
mytext
),
"_read _O_TEXT got bad length"
);
ok
(
memcmp
(
mytext
,
btext
,
strlen
(
mytext
))
==
0
,
"problems with _O_TEXT _write / _read"
);
_close
(
tempfd
);
ok
(
unlink
(
tempf
)
!=-
1
,
"Can't unlink
"
);
ok
(
unlink
(
tempf
)
!=-
1
,
"Can't unlink
'%s': %d"
,
tempf
,
errno
);
tempf
=
_tempnam
(
"."
,
"wne"
);
ok
((
tempfd
=
_open
(
tempf
,
_O_CREAT
|
_O_TRUNC
|
_O_BINARY
|
_O_RDWR
,
0
))
!=
-
1
,
"Can't open %s"
,
tempf
);
/* open in BINARY mode */
ok
(
_write
(
tempfd
,
dostext
,
strlen
(
dostext
))
==
lstrlenA
(
dostext
),
"_write _O_TEXT bad return value"
);
ok
((
tempfd
=
_open
(
tempf
,
_O_CREAT
|
_O_TRUNC
|
_O_BINARY
|
_O_RDWR
,
0
))
!=
-
1
,
"Can't open '%s': %d"
,
tempf
,
errno
);
/* open in BINARY mode */
ok
(
_write
(
tempfd
,
dostext
,
strlen
(
dostext
))
==
lstrlenA
(
dostext
),
"_write _O_BINARY bad return value"
);
_close
(
tempfd
);
tempfd
=
_open
(
tempf
,
_O_RDONLY
|
_O_BINARY
,
0
);
/* open in BINARY mode */
ok
(
_read
(
tempfd
,
btext
,
LLEN
)
==
lstrlenA
(
dostext
),
"_read _O_BINARY got bad length"
);
ok
(
memcmp
(
dostext
,
btext
,
strlen
(
dostext
))
==
0
,
"problems with _O_TEXT _write and _O_BINARY _write"
);
ok
(
btext
[
strlen
(
dostext
)
-
2
]
==
'\r'
,
"CR not written"
);
ok
(
_read
(
tempfd
,
btext
,
LLEN
)
==
lstrlenA
(
dostext
),
"_read _O_BINARY got bad length"
);
ok
(
memcmp
(
dostext
,
btext
,
strlen
(
dostext
))
==
0
,
"problems with _O_BINARY _write / _read"
);
ok
(
btext
[
strlen
(
dostext
)
-
2
]
==
'\r'
,
"CR not written or read"
);
_close
(
tempfd
);
tempfd
=
_open
(
tempf
,
_O_RDONLY
|
_O_TEXT
);
/* open in TEXT mode */
ok
(
_read
(
tempfd
,
btext
,
LLEN
)
==
lstrlenA
(
mytext
),
"_read _O_TEXT got bad length"
);
ok
(
memcmp
(
mytext
,
btext
,
strlen
(
mytext
))
==
0
,
"problems with _O_TEXT _write / _write"
);
ok
(
_read
(
tempfd
,
btext
,
LLEN
)
==
lstrlenA
(
mytext
),
"_read _O_TEXT got bad length"
);
ok
(
memcmp
(
mytext
,
btext
,
strlen
(
mytext
))
==
0
,
"problems with _O_BINARY _write / _O_TEXT _read"
);
_close
(
tempfd
);
unlink
(
tempf
);
ok
(
_chmod
(
tempf
,
_S_IREAD
|
_S_IWRITE
)
==
0
,
"Can't chmod '%s' to read-write: %d"
,
tempf
,
errno
);
ok
(
unlink
(
tempf
)
!=-
1
,
"Can't unlink '%s': %d"
,
tempf
,
errno
);
}
static
void
test_tmpnam
(
void
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment