Skip to content

Commit c8bb92d

Browse files
committed
atftp: add patch to fix build warning
This patch fixes the following compilation build warning: logger.c:117:47: warning: format '%li' expects argument of type 'long int', but argument 7 has type 117 | fprintf(log_fp, "%s %s %s[%d.%li]: %s\n", time_buf, hostname, | ~~^ | | | long int 118 | log_ident, getpid(), pthread_self(), message); | ~~~~~~~~~~~~~~ | | | pthread_t {aka struct __pthread *} logger.c:124:47: warning: format '%li' expects argument of type 'long int', but argument 7 has type 124 | fprintf(stderr, "%s %s %s[%d.%li]: %s\n", time_buf, hostname, | ~~^ | | | long int 125 | log_ident, getpid(), pthread_self(), message); | ~~~~~~~~~~~~~~ | | | pthread_t {aka struct __pthread *} I have also submitted the change to the upstream project: madmartin/atftp#2 Signed-off-by: Florian Eckert <[email protected]>
1 parent 16ada83 commit c8bb92d

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
From a9da732718bd917a50aa25a6ae59e791c2c30380 Mon Sep 17 00:00:00 2001
2+
From: Florian Eckert <[email protected]>
3+
Date: Tue, 2 Sep 2025 13:53:05 +0200
4+
Subject: [PATCH] Fix pthread_t format warning for fprintf
5+
6+
This change fixes the following compilation build warning:
7+
8+
logger.c:117:47: warning: format '%li' expects argument of type 'long int', but argument 7 has type 'pthread_t' {aka 'struct __pthread *'} [-Wformat=]
9+
117 | fprintf(log_fp, "%s %s %s[%d.%li]: %s\n", time_buf, hostname,
10+
| ~~^
11+
| |
12+
| long int
13+
118 | log_ident, getpid(), pthread_self(), message);
14+
| ~~~~~~~~~~~~~~
15+
| |
16+
| pthread_t {aka struct __pthread *}
17+
logger.c:124:47: warning: format '%li' expects argument of type 'long int', but argument 7 has type 'pthread_t' {aka 'struct __pthread *'} [-Wformat=]
18+
124 | fprintf(stderr, "%s %s %s[%d.%li]: %s\n", time_buf, hostname,
19+
| ~~^
20+
| |
21+
| long int
22+
125 | log_ident, getpid(), pthread_self(), message);
23+
| ~~~~~~~~~~~~~~
24+
| |
25+
| pthread_t {aka struct __pthread *}
26+
27+
Signed-off-by: Florian Eckert <[email protected]>
28+
---
29+
logger.c | 4 ++--
30+
1 file changed, 2 insertions(+), 2 deletions(-)
31+
32+
--- a/logger.c
33+
+++ b/logger.c
34+
@@ -115,14 +115,14 @@ void logger(int severity, const char *fm
35+
if (log_fp)
36+
{
37+
fprintf(log_fp, "%s %s %s[%d.%li]: %s\n", time_buf, hostname,
38+
- log_ident, getpid(), pthread_self(), message);
39+
+ log_ident, getpid(), (unsigned long int) pthread_self(), message);
40+
fflush(log_fp);
41+
}
42+
else if (log_syslog_is_open)
43+
syslog(severity, "%s", message);
44+
else
45+
fprintf(stderr, "%s %s %s[%d.%li]: %s\n", time_buf, hostname,
46+
- log_ident, getpid(), pthread_self(), message);
47+
+ log_ident, getpid(), (unsigned long int) pthread_self(), message);
48+
}
49+
va_end(args);
50+
}

0 commit comments

Comments
 (0)