This commit adds a few initial users but more are coming up.
va_list args;
va_start(args, format);
- ovs_error_valist(err_no, format, args);
- va_end(args);
+ ovs_fatal_valist(err_no, format, args);
+}
+/* Same as ovs_fatal() except that the arguments are supplied as a va_list. */
+void
+ovs_fatal_valist(int err_no, const char *format, va_list args)
+{
+ ovs_error_valist(err_no, format, args);
exit(EXIT_FAILURE);
}
PRINTF_FORMAT(2, 3) NO_RETURN;
void ovs_fatal(int err_no, const char *format, ...)
PRINTF_FORMAT(2, 3) NO_RETURN;
+void ovs_fatal_valist(int err_no, const char *format, va_list)
+ PRINTF_FORMAT(2, 0) NO_RETURN;
void ovs_error(int err_no, const char *format, ...) PRINTF_FORMAT(2, 3);
void ovs_error_valist(int err_no, const char *format, va_list)
PRINTF_FORMAT(2, 0);
if (retval) {
va_list args;
- fprintf(stderr, "%s: ", program_name);
va_start(args, message);
- vfprintf(stderr, message, args);
- va_end(args);
- if (retval == EOF) {
- fputs(": unexpected end of file\n", stderr);
- } else {
- fprintf(stderr, ": %s\n", strerror(retval));
- }
-
- exit(EXIT_FAILURE);
+ ovs_fatal_valist(retval, message, args);
}
}
\f
if (retval) {
va_list args;
- fprintf(stderr, "%s: ", program_name);
va_start(args, message);
- vfprintf(stderr, message, args);
- va_end(args);
- if (retval == EOF) {
- fputs(": unexpected end of file\n", stderr);
- } else {
- fprintf(stderr, ": %s\n", strerror(retval));
- }
-
- exit(EXIT_FAILURE);
+ ovs_fatal_valist(retval, message, args);
}
}
\f