#include "test.h"
#include "rmobj.h"
+#pragma GCC diagnostic ignored "-Wformat-overflow"
+#pragma GCC diagnostic ignored "-Wformat-truncation"
+
/*
* Define some useful macros.
*/
if ( getcwd(current_dir,PATH_MAX) == NULL )
strcpy(parent_dir, TESTDIR);
else
- sprintf(parent_dir, "%s/%s", current_dir, TESTDIR);
+ snprintf(parent_dir, sizeof parent_dir,
+ "%s/%s", current_dir, TESTDIR);
} else {
strcpy(parent_dir, TESTDIR);
}
/*#define PATH_MAX pathconf("/", _PC_PATH_MAX)*/
#endif
-char Wlog_Error_String[256];
+char Wlog_Error_String[2048];
#if __STDC__
static int wlog_rec_pack(struct wlog_rec *wrec, char *buf, int flag);
umask(omask);
if (wfile->w_afd == -1) {
- sprintf(Wlog_Error_String,
+ snprintf(Wlog_Error_String, sizeof Wlog_Error_String,
"Could not open write_log - open(%s, %#o, %#o) failed: %s\n",
wfile->w_file, oflags, mode, strerror(errno));
return -1;
oflags = O_RDWR;
if ((wfile->w_rfd = open(wfile->w_file, oflags)) == -1) {
- sprintf(Wlog_Error_String,
+ snprintf(Wlog_Error_String, sizeof Wlog_Error_String,
"Could not open write log - open(%s, %#o) failed: %s\n",
wfile->w_file, oflags, strerror(errno));
close(wfile->w_afd);
int (*func)();
long data;
{
- int fd, leftover, nbytes, offset, recnum, reclen, rval;
- char buf[BSIZE*32], *bufend, *cp, *bufstart;
+ int fd, leftover, nbytes, recnum, reclen, rval;
+ off_t offset;
+ char buf[BSIZE*32], *bufend, *cp, *bufstart;
char albuf[WLOG_REC_MAX_SIZE];
struct wlog_rec wrec;
nbytes = read(fd, bufstart, bufend - bufstart - leftover);
if (nbytes == -1) {
- sprintf(Wlog_Error_String,
- "Could not read history file at offset %d - read(%d, %#o, %d) failed: %s\n",
- offset, fd, (int)bufstart,
+ snprintf(Wlog_Error_String, sizeof Wlog_Error_String,
+ "Could not read history file at offset %jd - "
+ "read(%d, %#to, %td) failed: %s\n",
+ (intmax_t)offset, fd, (ptrdiff_t)bufstart,
bufend - bufstart - leftover, strerror(errno));
return -1;
}