Skip to content

Commit f2c33c4

Browse files
committed
clients/upsstats.c: display_template(): open HTML template in binary mode, so ftell()/fseek() work predictably [networkupstools#3219]
Fix rewinding FOREACHUPS command to the correct byte location on WIN32 (or other platforms with CR vs CRLF issues). Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
1 parent 88c5f8b commit f2c33c4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clients/upsstats.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,7 @@ static void display_template(const char *tfn)
10891089

10901090
snprintf(fn, sizeof(fn), "%s/%s", confpath(), tfn);
10911091

1092-
tf = fopen(fn, "r");
1092+
tf = fopen(fn, "rb");
10931093

10941094
if (!tf) {
10951095
fprintf(stderr, "upsstats: Can't open %s: %s\n", fn, strerror(errno));

0 commit comments

Comments
 (0)