Cygwin: testsuite: libltp: fix warnings showing up with -Wall
This libltp is old as old dirt and still using K&R style. If it's really to be used again at all, it needs a serious refresh. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
80e35a211f
commit
702bec7bc9
|
@ -98,12 +98,10 @@ char **errmsg;
|
||||||
{
|
{
|
||||||
int cnt;
|
int cnt;
|
||||||
unsigned char *chr;
|
unsigned char *chr;
|
||||||
int total;
|
|
||||||
long expbits;
|
long expbits;
|
||||||
long actbits;
|
long actbits;
|
||||||
|
|
||||||
chr=buffer;
|
chr=buffer;
|
||||||
total=bsize;
|
|
||||||
|
|
||||||
if ( errmsg != NULL ) {
|
if ( errmsg != NULL ) {
|
||||||
*errmsg = Errmsg;
|
*errmsg = Errmsg;
|
||||||
|
|
|
@ -50,6 +50,9 @@
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#pragma GCC diagnostic ignored "-Wformat-overflow"
|
||||||
|
#pragma GCC diagnostic ignored "-Wformat-truncation"
|
||||||
|
|
||||||
extern int errno;
|
extern int errno;
|
||||||
|
|
||||||
struct stat stbuf;
|
struct stat stbuf;
|
||||||
|
@ -221,7 +224,7 @@ printf("search_path: res_path = '%s'\n", res_path);
|
||||||
toolong++;
|
toolong++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
sprintf(tmppath, "%s/%s", curpath, res_path);
|
snprintf(tmppath, sizeof tmppath, "%s/%s", curpath, res_path);
|
||||||
strcpy(res_path, tmppath);
|
strcpy(res_path, tmppath);
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
printf("search_path: full res_path= '%s'\n", res_path);
|
printf("search_path: full res_path= '%s'\n", res_path);
|
||||||
|
|
|
@ -69,6 +69,9 @@
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
#include "rmobj.h"
|
#include "rmobj.h"
|
||||||
|
|
||||||
|
#pragma GCC diagnostic ignored "-Wformat-overflow"
|
||||||
|
#pragma GCC diagnostic ignored "-Wformat-truncation"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Define some useful macros.
|
* Define some useful macros.
|
||||||
*/
|
*/
|
||||||
|
@ -259,7 +262,8 @@ tst_rmdir()
|
||||||
if ( getcwd(current_dir,PATH_MAX) == NULL )
|
if ( getcwd(current_dir,PATH_MAX) == NULL )
|
||||||
strcpy(parent_dir, TESTDIR);
|
strcpy(parent_dir, TESTDIR);
|
||||||
else
|
else
|
||||||
sprintf(parent_dir, "%s/%s", current_dir, TESTDIR);
|
snprintf(parent_dir, sizeof parent_dir,
|
||||||
|
"%s/%s", current_dir, TESTDIR);
|
||||||
} else {
|
} else {
|
||||||
strcpy(parent_dir, TESTDIR);
|
strcpy(parent_dir, TESTDIR);
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@
|
||||||
/*#define PATH_MAX pathconf("/", _PC_PATH_MAX)*/
|
/*#define PATH_MAX pathconf("/", _PC_PATH_MAX)*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char Wlog_Error_String[256];
|
char Wlog_Error_String[2048];
|
||||||
|
|
||||||
#if __STDC__
|
#if __STDC__
|
||||||
static int wlog_rec_pack(struct wlog_rec *wrec, char *buf, int flag);
|
static int wlog_rec_pack(struct wlog_rec *wrec, char *buf, int flag);
|
||||||
|
@ -137,7 +137,7 @@ int mode;
|
||||||
umask(omask);
|
umask(omask);
|
||||||
|
|
||||||
if (wfile->w_afd == -1) {
|
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",
|
"Could not open write_log - open(%s, %#o, %#o) failed: %s\n",
|
||||||
wfile->w_file, oflags, mode, strerror(errno));
|
wfile->w_file, oflags, mode, strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -149,7 +149,7 @@ int mode;
|
||||||
|
|
||||||
oflags = O_RDWR;
|
oflags = O_RDWR;
|
||||||
if ((wfile->w_rfd = open(wfile->w_file, oflags)) == -1) {
|
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",
|
"Could not open write log - open(%s, %#o) failed: %s\n",
|
||||||
wfile->w_file, oflags, strerror(errno));
|
wfile->w_file, oflags, strerror(errno));
|
||||||
close(wfile->w_afd);
|
close(wfile->w_afd);
|
||||||
|
@ -255,7 +255,8 @@ int nrecs;
|
||||||
int (*func)();
|
int (*func)();
|
||||||
long data;
|
long data;
|
||||||
{
|
{
|
||||||
int fd, leftover, nbytes, offset, recnum, reclen, rval;
|
int fd, leftover, nbytes, recnum, reclen, rval;
|
||||||
|
off_t offset;
|
||||||
char buf[BSIZE*32], *bufend, *cp, *bufstart;
|
char buf[BSIZE*32], *bufend, *cp, *bufstart;
|
||||||
char albuf[WLOG_REC_MAX_SIZE];
|
char albuf[WLOG_REC_MAX_SIZE];
|
||||||
struct wlog_rec wrec;
|
struct wlog_rec wrec;
|
||||||
|
@ -295,9 +296,10 @@ long data;
|
||||||
nbytes = read(fd, bufstart, bufend - bufstart - leftover);
|
nbytes = read(fd, bufstart, bufend - bufstart - leftover);
|
||||||
|
|
||||||
if (nbytes == -1) {
|
if (nbytes == -1) {
|
||||||
sprintf(Wlog_Error_String,
|
snprintf(Wlog_Error_String, sizeof Wlog_Error_String,
|
||||||
"Could not read history file at offset %d - read(%d, %#o, %d) failed: %s\n",
|
"Could not read history file at offset %jd - "
|
||||||
offset, fd, (int)bufstart,
|
"read(%d, %#to, %td) failed: %s\n",
|
||||||
|
(intmax_t)offset, fd, (ptrdiff_t)bufstart,
|
||||||
bufend - bufstart - leftover, strerror(errno));
|
bufend - bufstart - leftover, strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue