Move abort() into opr
[openafs.git] / src / util / assert.c
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  *
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 /* ReallyAbort:  called from assert. May/85 */
11 #include <afsconfig.h>
12 #include <afs/param.h>
13
14 #include <roken.h>
15 #include <afs/opr.h>
16
17 #include "afsutil.h"
18
19 #define TIMESTAMP_BUFFER_SIZE 26  /* including the null */
20
21 void
22 AssertionFailed(char *file, int line)
23 {
24     char tdate[TIMESTAMP_BUFFER_SIZE];
25     time_t when;
26     struct tm tm;
27
28     when = time(NULL);
29     strftime(tdate, sizeof(tdate), "%a %b %d %H:%M:%S %Y",
30              localtime_r(&when, &tm));
31     fprintf(stderr, "%s Assertion failed! file %s, line %d.\n", tdate, file,
32             line);
33     fflush(stderr);
34     opr_abort();
35 }