/*
- * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* https://www.openssl.org/source/license.html
*/
+#if defined (__TANDEM) && defined (_SPT_MODEL_)
+/*
+ * These definitions have to come first in SPT due to scoping of the
+ * declarations in c99 associated with SPT use of stat.
+ */
+# include <sys/types.h>
+# include <sys/stat.h>
+#endif
+
#include "internal/cryptlib.h"
#include <errno.h>
return 0;
if ((in = openssl_fopen(file, "rb")) == NULL) {
- ERR_raise(ERR_LIB_RAND, RAND_R_CANNOT_OPEN_FILE);
- ERR_add_error_data(2, "Filename=", file);
+ ERR_raise_data(ERR_LIB_RAND, RAND_R_CANNOT_OPEN_FILE,
+ "Filename=%s", file);
return -1;
}
#ifndef OPENSSL_NO_POSIX_IO
if (fstat(fileno(in), &sb) < 0) {
- ERR_raise(ERR_LIB_RAND, RAND_R_INTERNAL_ERROR);
- ERR_add_error_data(2, "Filename=", file);
+ ERR_raise_data(ERR_LIB_RAND, RAND_R_INTERNAL_ERROR,
+ "Filename=%s", file);
fclose(in);
return -1;
}
OPENSSL_cleanse(buf, sizeof(buf));
fclose(in);
if (!RAND_status()) {
- ERR_raise(ERR_LIB_RAND, RAND_R_RESEED_ERROR);
- ERR_add_error_data(2, "Filename=", file);
+ ERR_raise_data(ERR_LIB_RAND, RAND_R_RESEED_ERROR, "Filename=%s", file);
return -1;
}
struct stat sb;
if (stat(file, &sb) >= 0 && !S_ISREG(sb.st_mode)) {
- ERR_raise(ERR_LIB_RAND, RAND_R_NOT_A_REGULAR_FILE);
- ERR_add_error_data(2, "Filename=", file);
+ ERR_raise_data(ERR_LIB_RAND, RAND_R_NOT_A_REGULAR_FILE,
+ "Filename=%s", file);
return -1;
}
#endif
if (out == NULL)
out = openssl_fopen(file, "wb");
if (out == NULL) {
- ERR_raise(ERR_LIB_RAND, RAND_R_CANNOT_OPEN_FILE);
- ERR_add_error_data(2, "Filename=", file);
+ ERR_raise_data(ERR_LIB_RAND, RAND_R_CANNOT_OPEN_FILE,
+ "Filename=%s", file);
return -1;
}