xfs: quotas on idmapped mounts
[xfstests-dev.git] / lib / write_log.c
index 8c921fc54244bc456f378ecf624a62be26cb6c3d..cdc72593b9dcc3932161e6da1265254ad681c4f5 100644 (file)
@@ -1,19 +1,7 @@
+// 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 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.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 /*
  * This module contains code for logging writes to files, and for
@@ -73,7 +61,8 @@
 /*#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);
@@ -120,7 +109,7 @@ int                 mode;
        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;
@@ -132,7 +121,7 @@ int                 mode;
 
        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);