Skip to content

Commit

Permalink
Fix for gcc 10
Browse files Browse the repository at this point in the history
Gcc 10 defaults to -fno-common, leading to multiple global definitions
to cause a linker error.
  • Loading branch information
walley authored and rodarima committed Jun 2, 2023
1 parent 479a133 commit 4d35673
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 12 deletions.
14 changes: 7 additions & 7 deletions dpid/dpid.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@

/*! \TODO: Should read this from dillorc */
#define SRS_NAME "dpid.srs"
char *srs_name;
extern char *srs_name;

/*! dpid's service request socket file descriptor */
int srs_fd;
extern int srs_fd;

/*! plugin state information
*/
Expand All @@ -49,19 +49,19 @@ struct service {
};

/*! Number of available plugins */
int numdpis;
extern int numdpis;

/*! Number of sockets being watched */
int numsocks;
extern int numsocks;

/*! State information for each plugin. */
struct dp *dpi_attr_list;
extern struct dp *dpi_attr_list;

/*! service served for each plugin */
Dlist *services_list;
extern Dlist *services_list;

/*! Set of sockets watched for connections */
fd_set sock_set;
extern fd_set sock_set;

/*! Set to 1 by the SIGCHLD handler dpi_sigchld */
extern volatile sig_atomic_t caught_sigchld;
Expand Down
7 changes: 2 additions & 5 deletions dpid/dpid_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,9 @@
#define CKD_WRITE(fd, msg) ckd_write(fd, msg, __FILE__, __LINE__)
#define CKD_CLOSE(fd) ckd_close(fd, __FILE__, __LINE__)


/*! Error codes for dpid */
enum {
no_errors,
dpid_srs_addrinuse /* dpid service request socket address already in use */
} dpi_errno;
//fix for gcc 10
extern enum dpi_errno;

/*! Intended for identifying dillo plugins
* and related files
Expand Down
20 changes: 20 additions & 0 deletions dpid/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/*
Copyright (C) 2003 Ferdi Franceschini <[email protected]>
2020 Axel Beckert <[email protected]>
2023 Michal Grezl <[email protected]>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -32,6 +34,24 @@

sigset_t mask_sigchld;

/* fix for gcc 10 */

enum {
no_errors,
dpid_srs_addrinuse /* dpid service request socket address already in use */
} dpi_errno;

char *srs_name;
int numdpis;
fd_set sock_set;
struct dp *dpi_attr_list;
Dlist *services_list;
int numsocks;
int srs_fd;
;

// end of fix


/* Start a dpi filter plugin after accepting the pending connection
* \Return
Expand Down

0 comments on commit 4d35673

Please sign in to comment.