Permalink
Browse files

Github issue #11: Use sig_atomic_t within signal handlers.

The variables "discoveryFlags" and "finished" should use the
data type "sig_atomic_t" within pmfind and pmsleep respectively.
  • Loading branch information...
1 parent d19528c commit 9478ca09877f90c5c890355324689ed2c103a5b4 @dbrolley dbrolley committed with goodwinos May 27, 2015
Showing with 7 additions and 6 deletions.
  1. +1 −1 src/include/pcp/impl.h
  2. +1 −1 src/libpcp/src/discovery.c
  3. +1 −1 src/libpcp/src/internal.h
  4. +2 −2 src/pmfind/pmfind.c
  5. +2 −1 src/pmsleep/pmsleep.c
View
@@ -1489,7 +1489,7 @@ extern void *__pmLock_libpcp; /* symbol exposure */
extern int __pmDiscoverServicesWithOptions(const char *,
const char *,
const char *,
- const volatile unsigned *,
+ const volatile sig_atomic_t *,
char ***);
@@ -161,7 +161,7 @@ int
__pmDiscoverServicesWithOptions(const char *service,
const char *mechanism,
const char *optionsString,
- const volatile unsigned *flags,
+ const volatile sig_atomic_t *flags,
char ***urls)
{
__pmServiceDiscoveryOptions options;
@@ -257,7 +257,7 @@ typedef struct {
} __pmServiceInfo;
typedef struct {
- const volatile unsigned *flags; /* Service discovery flags */
+ const volatile sig_atomic_t *flags; /* Service discovery flags */
struct timeval timeout; /* Global timeout period */
volatile int timedOut; /* Global timeout occurred */
int resolve; /* Resolve discovered addresses */
View
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2014 Red Hat.
+ * Copyright (c) 2013-2015 Red Hat.
*
* 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 the
@@ -18,7 +18,7 @@
static int quiet;
static char *mechanism;
static char *options;
-static unsigned discoveryFlags;
+static volatile sig_atomic_t discoveryFlags;
static int override(int, pmOptions *);
View
@@ -15,9 +15,10 @@
#include "pmapi.h"
#include "impl.h"
+#include <signal.h>
#include <sys/wait.h>
-static int finished;
+static volatile sig_atomic_t finished;
static void
sigterm(int sig)

0 comments on commit 9478ca0

Please sign in to comment.