Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Was wrongly saving default handlers #109

Merged
merged 1 commit into from

2 participants

Pieter Hintjens Felipe Cruz
Pieter Hintjens
Owner

No description provided.

Felipe Cruz felipecruz merged commit a837cbd into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 4, 2013
  1. Pieter Hintjens
This page is out of date. Refresh to see the latest.
Showing with 33 additions and 8 deletions.
  1. +26 −3 doc/zsys.txt
  2. +7 −5 src/zsys.c
29 doc/zsys.txt
View
@@ -8,13 +8,36 @@ zsys - system wrapper
SYNOPSIS
--------
----
+// Callback for interrupt signal handler
+typedef void (zsys_handler_fn) (int signal_value);
+
+// Set interrupt handler (NULL means external handler)
+CZMQ_EXPORT void
+ zsys_handler_set (zsys_handler_fn *handler_fn);
+
+// Reset interrupt handler, call this at exit if needed
+CZMQ_EXPORT void
+ zsys_handler_reset (void);
+
+// Return file mode
+CZMQ_EXPORT mode_t
+ zsys_mode (const char *filename);
+
// Create a file path if it doesn't exit
CZMQ_EXPORT void
- zsys_mkdir (zsys_t *self, char *pathname);
+ zsys_mkdir (const char *pathname);
+
+// Remove a file path if empty
+CZMQ_EXPORT void
+ zsys_rmdir (const char *pathname);
-// Remove a file path with multiple levels
+// Delete a file
CZMQ_EXPORT void
- zsys_rmdir (zsys_t *self, char *pathname, bool force);
+ zsys_unlink (const char *filename);
+
+// Check if file is 'stable'
+CZMQ_EXPORT bool
+ zsys_stable (const char *filename);
// Self test of this class
int
12 src/zsys.c
View
@@ -59,12 +59,14 @@ zsys_handler_set (zsys_handler_fn *handler_fn)
action.sa_handler = handler_fn;
action.sa_flags = 0;
sigemptyset (&action.sa_mask);
- sigaction (SIGINT, &action, NULL);
- sigaction (SIGTERM, &action, NULL);
+ sigaction (SIGINT, &action, &sigint_default);
+ sigaction (SIGTERM, &action, &sigterm_default);
+ }
+ else {
+ // Save default handlers if not already done
+ sigaction (SIGINT, NULL, &sigint_default);
+ sigaction (SIGTERM, NULL, &sigterm_default);
}
- // Save default handlers if not already done
- sigaction (SIGINT, NULL, &sigint_default);
- sigaction (SIGTERM, NULL, &sigterm_default);
}
#endif
}
Something went wrong with that request. Please try again.