[Midnightbsd-cvs] src [11487] trunk/usr.bin/mail: fix some issues
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sat Jul 7 13:30:20 EDT 2018
Revision: 11487
http://svnweb.midnightbsd.org/src/?rev=11487
Author: laffer1
Date: 2018-07-07 13:30:20 -0400 (Sat, 07 Jul 2018)
Log Message:
-----------
fix some issues
Modified Paths:
--------------
trunk/usr.bin/mail/Makefile
trunk/usr.bin/mail/aux.c
trunk/usr.bin/mail/cmd1.c
trunk/usr.bin/mail/cmd2.c
trunk/usr.bin/mail/cmd3.c
trunk/usr.bin/mail/cmdtab.c
trunk/usr.bin/mail/collect.c
trunk/usr.bin/mail/def.h
trunk/usr.bin/mail/edit.c
trunk/usr.bin/mail/extern.h
trunk/usr.bin/mail/fio.c
Modified: trunk/usr.bin/mail/Makefile
===================================================================
--- trunk/usr.bin/mail/Makefile 2018-07-07 17:30:03 UTC (rev 11486)
+++ trunk/usr.bin/mail/Makefile 2018-07-07 17:30:20 UTC (rev 11487)
@@ -1,5 +1,6 @@
+# $MidnightBSD$
# @(#)Makefile 8.2 (Berkeley) 1/25/94
-# $MidnightBSD$
+# $FreeBSD: stable/10/usr.bin/mail/Makefile 201386 2010-01-02 10:27:05Z ed $
PROG= mail
SRCS= version.c cmd1.c cmd2.c cmd3.c cmdtab.c collect.c edit.c fio.c \
Modified: trunk/usr.bin/mail/aux.c
===================================================================
--- trunk/usr.bin/mail/aux.c 2018-07-07 17:30:03 UTC (rev 11486)
+++ trunk/usr.bin/mail/aux.c 2018-07-07 17:30:20 UTC (rev 11487)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 1980, 1993
* The Regents of the University of California. All rights reserved.
Modified: trunk/usr.bin/mail/cmd1.c
===================================================================
--- trunk/usr.bin/mail/cmd1.c 2018-07-07 17:30:03 UTC (rev 11486)
+++ trunk/usr.bin/mail/cmd1.c 2018-07-07 17:30:20 UTC (rev 11487)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1980, 1993
* The Regents of the University of California. All rights reserved.
@@ -33,7 +34,7 @@
#endif
#endif /* not lint */
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/mail/cmd1.c 228647 2011-12-17 16:30:42Z dim $");
#include "rcv.h"
#include "extern.h"
Modified: trunk/usr.bin/mail/cmd2.c
===================================================================
--- trunk/usr.bin/mail/cmd2.c 2018-07-07 17:30:03 UTC (rev 11486)
+++ trunk/usr.bin/mail/cmd2.c 2018-07-07 17:30:20 UTC (rev 11487)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 1980, 1993
* The Regents of the University of California. All rights reserved.
@@ -33,7 +34,7 @@
#endif
#endif /* not lint */
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/mail/cmd2.c 216564 2010-12-19 16:25:23Z charnier $");
#include "rcv.h"
#include <sys/wait.h>
Modified: trunk/usr.bin/mail/cmd3.c
===================================================================
--- trunk/usr.bin/mail/cmd3.c 2018-07-07 17:30:03 UTC (rev 11486)
+++ trunk/usr.bin/mail/cmd3.c 2018-07-07 17:30:20 UTC (rev 11487)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 1980, 1993
* The Regents of the University of California. All rights reserved.
@@ -33,7 +34,7 @@
#endif
#endif /* not lint */
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/mail/cmd3.c 302968 2016-07-17 18:32:33Z pfg $");
#include "rcv.h"
#include "extern.h"
@@ -463,7 +464,8 @@
gname = *argv;
h = hash(gname);
if ((gh = findgroup(gname)) == NULL) {
- gh = calloc(sizeof(*gh), 1);
+ if ((gh = calloc(1, sizeof(*gh))) == NULL)
+ err(1, "Out of memory");
gh->g_name = vcopy(gname);
gh->g_list = NULL;
gh->g_link = groups[h];
@@ -477,7 +479,8 @@
*/
for (ap = argv+1; *ap != NULL; ap++) {
- gp = calloc(sizeof(*gp), 1);
+ if ((gp = calloc(1, sizeof(*gp))) == NULL)
+ err(1, "Out of memory");
gp->ge_name = vcopy(*ap);
gp->ge_link = gh->g_list;
gh->g_list = gp;
@@ -702,7 +705,8 @@
}
if (altnames != 0)
(void)free(altnames);
- altnames = calloc((unsigned)c, sizeof(char *));
+ if ((altnames = calloc((unsigned)c, sizeof(char *))) == NULL)
+ err(1, "Out of memory");
for (ap = namelist, ap2 = altnames; *ap != NULL; ap++, ap2++) {
cp = calloc((unsigned)strlen(*ap) + 1, sizeof(char));
strcpy(cp, *ap);
Modified: trunk/usr.bin/mail/cmdtab.c
===================================================================
--- trunk/usr.bin/mail/cmdtab.c 2018-07-07 17:30:03 UTC (rev 11486)
+++ trunk/usr.bin/mail/cmdtab.c 2018-07-07 17:30:20 UTC (rev 11487)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 1980, 1993
* The Regents of the University of California. All rights reserved.
@@ -33,7 +34,7 @@
#endif
#endif /* not lint */
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/mail/cmdtab.c 216370 2010-12-11 08:32:16Z joel $");
#include "def.h"
#include "extern.h"
Modified: trunk/usr.bin/mail/collect.c
===================================================================
--- trunk/usr.bin/mail/collect.c 2018-07-07 17:30:03 UTC (rev 11486)
+++ trunk/usr.bin/mail/collect.c 2018-07-07 17:30:20 UTC (rev 11487)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 1980, 1993
* The Regents of the University of California. All rights reserved.
@@ -33,7 +34,7 @@
#endif
#endif /* not lint */
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/mail/collect.c 303280 2016-07-25 00:46:01Z delphij $");
/*
* Mail -- a mail program
@@ -339,9 +340,9 @@
int nullfd, tempfd, rc;
char tempname2[PATHSIZE];
- if ((nullfd = open("/dev/null", O_RDONLY, 0))
+ if ((nullfd = open(_PATH_DEVNULL, O_RDONLY, 0))
== -1) {
- warn("/dev/null");
+ warn(_PATH_DEVNULL);
break;
}
Modified: trunk/usr.bin/mail/def.h
===================================================================
--- trunk/usr.bin/mail/def.h 2018-07-07 17:30:03 UTC (rev 11486)
+++ trunk/usr.bin/mail/def.h 2018-07-07 17:30:20 UTC (rev 11487)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 1980, 1993
* The Regents of the University of California. All rights reserved.
@@ -28,7 +29,7 @@
*
* @(#)def.h 8.4 (Berkeley) 4/20/95
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/usr.bin/mail/def.h 296498 2016-03-08 14:38:06Z pfg $
*/
/*
@@ -270,5 +271,5 @@
*/
#define trunc(stream) { \
(void)fflush(stream); \
- (void)ftruncate(fileno(stream), (off_t)ftell(stream)); \
+ (void)ftruncate(fileno(stream), ftello(stream)); \
}
Modified: trunk/usr.bin/mail/edit.c
===================================================================
--- trunk/usr.bin/mail/edit.c 2018-07-07 17:30:03 UTC (rev 11486)
+++ trunk/usr.bin/mail/edit.c 2018-07-07 17:30:20 UTC (rev 11487)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 1980, 1993
* The Regents of the University of California. All rights reserved.
@@ -33,7 +34,7 @@
#endif
#endif /* not lint */
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/mail/edit.c 270756 2014-08-28 18:11:05Z pfg $");
#include "rcv.h"
#include <fcntl.h>
@@ -81,7 +82,7 @@
/*
* Deal with each message to be edited . . .
*/
- for (i = 0; msgvec[i] && i < msgCount; i++) {
+ for (i = 0; i < msgCount && msgvec[i]; i++) {
sig_t sigint;
if (i > 0) {
@@ -89,7 +90,7 @@
char *p;
printf("Edit message %d [ynq]? ", msgvec[i]);
- if (fgets(buf, sizeof(buf), stdin) == 0)
+ if (fgets(buf, sizeof(buf), stdin) == NULL)
break;
for (p = buf; *p == ' ' || *p == '\t'; p++)
;
Modified: trunk/usr.bin/mail/extern.h
===================================================================
--- trunk/usr.bin/mail/extern.h 2018-07-07 17:30:03 UTC (rev 11486)
+++ trunk/usr.bin/mail/extern.h 2018-07-07 17:30:20 UTC (rev 11487)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -28,7 +29,7 @@
*
* @(#)extern.h 8.2 (Berkeley) 4/20/95
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/usr.bin/mail/extern.h 228468 2011-12-13 13:32:56Z ed $
*/
struct name *cat(struct name *, struct name *);
@@ -154,7 +155,7 @@
int isign(const char *, struct ignoretab []);
int isprefix(const char *, const char *);
void istrncpy(char *, const char *, size_t);
-__const struct cmd *
+const struct cmd *
lex(char []);
void load(char *);
struct var *
Modified: trunk/usr.bin/mail/fio.c
===================================================================
--- trunk/usr.bin/mail/fio.c 2018-07-07 17:30:03 UTC (rev 11486)
+++ trunk/usr.bin/mail/fio.c 2018-07-07 17:30:20 UTC (rev 11487)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*
* Copyright (c) 1980, 1993
* The Regents of the University of California. All rights reserved.
@@ -33,7 +34,7 @@
#endif
#endif /* not lint */
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/mail/fio.c 300274 2016-05-20 06:41:26Z truckman $");
#include "rcv.h"
#include <sys/file.h>
@@ -367,10 +368,10 @@
name = savestr(xname);
}
if (!strpbrk(name, "~{[*?$`'\"\\"))
- return (name);
+ return (savestr(name));
if (pipe(pivec) < 0) {
warn("pipe");
- return (name);
+ return (NULL);
}
(void)snprintf(cmdbuf, sizeof(cmdbuf), "echo %s", name);
if ((sh = value("SHELL")) == NULL)
More information about the Midnightbsd-cvs
mailing list