Skip to contentSkip to conversation

reexport.c: Some Distros need the following include to avoid the following error

PATCH In review Steve Dickson 1 participant 2 messages Jan 22, 2024 – Jan 23, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 reexport.c: Some Distros need the following include to avoid the following error

reexport.c: In function ‘connect_fsid_service’:
reexport.c:41:28: error: implicit declaration of function ‘offsetof’ [-Werror=implicit-function-declaration]
41 | addr_len = offsetof(struct sockaddr_un, sun_path) + strlen(addr.sun_path);
| ^~~~~~~~
reexport.c:19:1: note: ‘offsetof’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’?

   18 | #include "xlog.h"
  +++ |+#include <stddef.h>
   19 |

reexport.c:41:37: error: expected expression before ‘struct’
41 | addr_len = offsetof(struct sockaddr_un, sun_path) + strlen(addr.sun_path);
| ^~~~~~
cc1: some warnings being treated as errors

---
 support/reexport/reexport.c | 1 +
 1 file changed, 1 insertion(+)
support/reexport/reexport.c +1 -0
index c7bff6a..1febf59 100644
@@ -9,6 +9,7 @@
 #include <sys/vfs.h>
 #include <unistd.h>
 #include <errno.h>
+#include <stddef.h>
 
 #include "nfsd_path.h"
 #include "conffile.h"
Signature · 1 line
2.43.0
#1 lore raw
Quoted 11 lines · Steve Dickson

reexport.c: In function ‘connect_fsid_service’:
reexport.c:41:28: error: implicit declaration of function ‘offsetof’ [-Werror=implicit-function-declaration]

    41 |                 addr_len = offsetof(struct sockaddr_un, sun_path) + strlen(addr.sun_path);
       |                            ^~~~~~~~
reexport.c:19:1: note: ‘offsetof’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’?
    18 | #include "xlog.h"
   +++ |+#include <stddef.h>
    19 |
reexport.c:41:37: error: expected expression before ‘struct’
    41 |                 addr_len = offsetof(struct sockaddr_un, sun_path) + strlen(addr.sun_path);
       |                                     ^~~~~~
Quoted 3 lines

cc1: some warnings being treated as errors

Committed... (tag: nfs-utils-2-7-1-rc4)

steved.

Quoted 16 lines
---
  support/reexport/reexport.c | 1 +
  1 file changed, 1 insertion(+)
support/reexport/reexport.c +1 -0
index c7bff6a..1febf59 100644
@@ -9,6 +9,7 @@
  #include <sys/vfs.h>
  #include <unistd.h>
  #include <errno.h>
+#include <stddef.h>
 
  #include "nfsd_path.h"
  #include "conffile.h"