applied new kernel API (*flags* -> *cflags*, *_context -> ctx_*)
[util-vserver.git] / util-vserver / ensc_wrappers / wrappers_handler.hc
index 7f7ca44..b89baf7 100644 (file)
 #include <stdbool.h>
 #include <stdio.h>
 
-static UNUSED void 
-FatalErrnoError(bool condition, char const msg[]) /*@*/
+static inline ALWAYSINLINE NORETURN void
+FatalErrnoErrorFail(char const msg[])
 {
   extern int   wrapper_exit_code;
 
-  if (!condition)       return;
+#ifdef ENSC_WRAPPERS_PREFIX
+  {
+    int                old_errno = errno;
+    WRITE_MSG(2, ENSC_WRAPPERS_PREFIX);
+    errno = old_errno;
+  }
+#endif
   perror(msg);
-
+  
   exit(wrapper_exit_code);
 }
+
+static UNUSED void 
+FatalErrnoError(bool condition, char const msg[]) /*@*/
+{
+  if (__builtin_expect(!condition,true))       return;
+  FatalErrnoErrorFail(msg);
+}