diff mbox series

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

Message ID 20240122182909.97503-1-steved@redhat.com (mailing list archive)
State New
Headers show
Series reexport.c: Some Distros need the following include to avoid the following error | expand

Commit Message

Steve Dickson Jan. 22, 2024, 6:29 p.m. UTC
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

Signed-off-by: Steve Dickson <steved@redhat.com>
---
 support/reexport/reexport.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Steve Dickson Jan. 23, 2024, 3:16 p.m. UTC | #1
On 1/22/24 1:29 PM, Steve Dickson wrote:
> 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
> 
> Signed-off-by: Steve Dickson <steved@redhat.com>
Committed... (tag: nfs-utils-2-7-1-rc4)

steved.
> ---
>   support/reexport/reexport.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/support/reexport/reexport.c b/support/reexport/reexport.c
> index c7bff6a..1febf59 100644
> --- a/support/reexport/reexport.c
> +++ b/support/reexport/reexport.c
> @@ -9,6 +9,7 @@
>   #include <sys/vfs.h>
>   #include <unistd.h>
>   #include <errno.h>
> +#include <stddef.h>
>   
>   #include "nfsd_path.h"
>   #include "conffile.h"
diff mbox series

Patch

diff --git a/support/reexport/reexport.c b/support/reexport/reexport.c
index c7bff6a..1febf59 100644
--- a/support/reexport/reexport.c
+++ b/support/reexport/reexport.c
@@ -9,6 +9,7 @@ 
 #include <sys/vfs.h>
 #include <unistd.h>
 #include <errno.h>
+#include <stddef.h>
 
 #include "nfsd_path.h"
 #include "conffile.h"