maint: update copyright
[gnulib.git] / lib / raise.c
index 980c9fd..cf58a7e 100644 (file)
@@ -1,6 +1,6 @@
 /* Provide a non-threads replacement for the POSIX raise function.
 
-   Copyright (C) 2002-2003, 2005-2006, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2002-2003, 2005-2006, 2009-2014 Free Software Foundation, Inc.
 
    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
@@ -32,7 +32,7 @@
 # undef raise
 
 # if HAVE_MSVC_INVALID_PARAMETER_HANDLER
-static inline int
+static int
 raise_nothrow (int sig)
 {
   int result;
@@ -50,24 +50,30 @@ raise_nothrow (int sig)
 
   return result;
 }
-#  define raise raise_nothrow
+# else
+#  define raise_nothrow raise
 # endif
 
-int
-rpl_raise (int sig)
-{
-  return raise_nothrow (sig);
-}
-
 #else
 /* An old Unix platform.  */
 
 # include <unistd.h>
 
+# define rpl_raise raise
+
+#endif
+
 int
-raise (int sig)
+rpl_raise (int sig)
 {
-  return kill (getpid (), sig);
-}
+#if GNULIB_defined_signal_blocking && GNULIB_defined_SIGPIPE
+  if (sig == SIGPIPE)
+    return _gl_raise_SIGPIPE ();
+#endif
 
+#if HAVE_RAISE
+  return raise_nothrow (sig);
+#else
+  return kill (getpid (), sig);
 #endif
+}