+// SPDX-License-Identifier: GPL-2.0
/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
+ * Copyright (c) 2000 Silicon Graphics, Inc.
+ * All Rights Reserved.
*/
/*
* This module contains code for logging writes to files, and for
#include <fcntl.h>
#include <errno.h>
#include <string.h>
+#include <strings.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/types.h>
/*#define PATH_MAX pathconf("/", _PC_PATH_MAX)*/
#endif
-char Wlog_Error_String[256];
+#define ERROR_STRING_LEN 1280
+char Wlog_Error_String[ERROR_STRING_LEN];
#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, ERROR_STRING_LEN,
"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, ERROR_STRING_LEN,
"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;
+ int fd, leftover, nbytes, offset, recnum, reclen;
char buf[BSIZE*32], *bufend, *cp, *bufstart;
char albuf[WLOG_REC_MAX_SIZE];
struct wlog_rec wrec;
* stop if instructed to.
*/
- if ((rval = (*func)(&wrec, data)) == WLOG_STOP_SCAN) {
+ if ((*func)(&wrec, data) == WLOG_STOP_SCAN) {
break;
}