summaryrefslogtreecommitdiff
path: root/pr/tests/op_excl.c
diff options
context:
space:
mode:
Diffstat (limited to 'pr/tests/op_excl.c')
-rw-r--r--pr/tests/op_excl.c50
1 files changed, 32 insertions, 18 deletions
diff --git a/pr/tests/op_excl.c b/pr/tests/op_excl.c
index 630b7637..e214af12 100644
--- a/pr/tests/op_excl.c
+++ b/pr/tests/op_excl.c
@@ -55,23 +55,25 @@ int main(int argc, char **argv)
PLOptStatus os;
PLOptState *opt = PL_CreateOptState(argc, argv, "hd");
- while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
+ while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
{
- if (PL_OPT_BAD == os) continue;
+ if (PL_OPT_BAD == os) {
+ continue;
+ }
switch (opt->option)
{
- case 'd': /* debug */
- debug = 1;
- msgLevel = PR_LOG_ERROR;
- break;
- case 'h': /* help message */
- Help();
- break;
- default:
- break;
+ case 'd': /* debug */
+ debug = 1;
+ msgLevel = PR_LOG_ERROR;
+ break;
+ case 'h': /* help message */
+ Help();
+ break;
+ default:
+ break;
}
}
- PL_DestroyOptState(opt);
+ PL_DestroyOptState(opt);
}
lm = PR_NewLogModule("Test"); /* Initialize logging */
@@ -81,21 +83,27 @@ int main(int argc, char **argv)
*/
fd = PR_Open( NEW_FILENAME, PR_CREATE_FILE | PR_EXCL | PR_WRONLY, 0666 );
if ( NULL == fd ) {
- if (debug) fprintf( stderr, "Open exclusive. Expected success, got failure\n");
+ if (debug) {
+ fprintf( stderr, "Open exclusive. Expected success, got failure\n");
+ }
failed_already = 1;
goto Finished;
}
written = PR_Write( fd, outBuf, OUT_SIZE );
if ( OUT_SIZE != written ) {
- if (debug) fprintf( stderr, "Write after open exclusive failed\n");
+ if (debug) {
+ fprintf( stderr, "Write after open exclusive failed\n");
+ }
failed_already = 1;
goto Finished;
}
rv = PR_Close(fd);
if ( PR_FAILURE == rv ) {
- if (debug) fprintf( stderr, "Close after open exclusive failed\n");
+ if (debug) {
+ fprintf( stderr, "Close after open exclusive failed\n");
+ }
failed_already = 1;
goto Finished;
}
@@ -105,19 +113,25 @@ int main(int argc, char **argv)
*/
fd = PR_Open( NEW_FILENAME, PR_CREATE_FILE | PR_EXCL | PR_WRONLY, 0666 );
if ( NULL != fd ) {
- if (debug) fprintf( stderr, "Open exclusive. Expected failure, got success\n");
+ if (debug) {
+ fprintf( stderr, "Open exclusive. Expected failure, got success\n");
+ }
failed_already = 1;
PR_Close(fd);
}
rv = PR_Delete( NEW_FILENAME );
if ( PR_FAILURE == rv ) {
- if (debug) fprintf( stderr, "PR_Delete() failed\n");
+ if (debug) {
+ fprintf( stderr, "PR_Delete() failed\n");
+ }
failed_already = 1;
}
Finished:
- if (debug) printf("%s\n", (failed_already)? "FAIL" : "PASS");
+ if (debug) {
+ printf("%s\n", (failed_already)? "FAIL" : "PASS");
+ }
return( (failed_already == PR_TRUE )? 1 : 0 );
} /* main() */
/* end op_excl.c */