Skip to content

Commit 96c8455

Browse files
committed
bug fix in glue file for Linux with file sharing/locking.
1 parent c615fb6 commit 96c8455

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

dev/minGlue-Linux.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,23 @@
1515
#define INI_FILETYPE FILE*
1616

1717
static inline int ini_openread(const char *filename, INI_FILETYPE *file) {
18-
if ((*file = fopen((filename),"r")) == NULL)
18+
if ((*file = fopen((filename), "r")) == NULL)
1919
return 0;
2020
return flock(fileno(*file), LOCK_SH) == 0;
2121
}
2222

2323
static inline int ini_openwrite(const char *filename, INI_FILETYPE *file) {
24-
if ((*file = fopen((filename),"r+")) == NULL
25-
&& (*file = fopen((filename),"w")) == NULL)
24+
if ((*file = fopen((filename), "r+")) == NULL
25+
&& (*file = fopen((filename), "w")) == NULL)
2626
return 0;
2727
if (flock(fileno(*file), LOCK_EX) < 0)
2828
return 0;
29-
return ftruncate(fileno(*file), 0);
29+
return ftruncate(fileno(*file), 0) == 0;
3030
}
3131

3232
#define INI_OPENREWRITE
3333
static inline int ini_openrewrite(const char *filename, INI_FILETYPE *file) {
34-
if ((*file = fopen((filename),"r+")) == NULL)
34+
if ((*file = fopen((filename), "r+")) == NULL)
3535
return 0;
3636
return flock(fileno(*file), LOCK_EX) == 0;
3737
}

doc/minIni.pdf

2 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)