Commit Graph

153 Commits

Author SHA1 Message Date
Xin LI
1d1e1f6311 Don't reference NULL pointer.
MFC after:	2 weeks
2017-01-24 07:48:36 +00:00
Xin LI
4994a9b8e0 Always initialize 'c'.
MFC after:	2 weeks
2017-01-23 07:32:47 +00:00
Xin LI
c0d0b76655 When creating record file, use umask 077 instead of the default.
MFC after:	2 weeks
2017-01-23 06:04:43 +00:00
Pedro F. Giffuni
eeb341a9f3 mail(1): Minor declaration updates.
Missing from r302903.
2016-07-15 20:27:21 +00:00
Pedro F. Giffuni
c433bea8c0 mail(1): Avoid closing negative file descriptors.
CID:		1008105, 1008106
MFC after:	1 week
2016-07-15 19:43:24 +00:00
Pedro F. Giffuni
b948550d2f mail(1): Update more prototypes.
Also rename delete and undelete_messages to deletecmd and undeletecmd
respectively in an attempt to sync with other BSDs.

Obtained from:	OpenBSD
2016-07-15 15:37:54 +00:00
Pedro F. Giffuni
20a50e9ca9 mail(1): check for out of memory conditions when calling calloc(3).
X-MFC with:	r302771
2016-07-14 15:09:08 +00:00
Pedro F. Giffuni
92fa728bb1 mail(1): Bring some fixes from other BSDs.
Fix missing forked job changes from r302776 in wait_child().

Obtained from:	NetBSD
2016-07-14 02:25:29 +00:00
Pedro F. Giffuni
b22a869924 mail(1): Bring some fixes from other BSDs.
- Use varargs properly
- Use pid_t
- Better handling of error conditions on forked jobs.
- Some prototype and warning cleanups.

Obtained from:	NetBSD (some originaly from OpenBSD)
2016-07-13 16:45:26 +00:00
Pedro F. Giffuni
dde0f2bfd3 mail(1): check for out of memory conditions when calling calloc(3).
Suggested by:	oshogbo
MFC after:	3 days
2016-07-13 14:59:17 +00:00
Xin LI
56858424bb Use _PATH_DEVNULL instead of hardcoding.
MFC after:	2 weeks
2016-07-11 05:44:58 +00:00
Pedro F. Giffuni
24b797cc1a mail(1): Fix a comment.
Obtained from:	NetBSD (CVS Rev 1.29)
2016-07-11 00:03:39 +00:00
Pedro F. Giffuni
d6f7a4fb17 mail(1): Invert calloc(3) argument order.
calloc(3) is documented to have first a number and then a size.

Obtained from:	OpenBSD (through NetBSD)
2016-07-10 02:46:20 +00:00
Don Lewis
090fc1c839 Always return either a dynamically allocated string or NULL from
expand().  Never return the name parameter, which could be a the buf[]
buffer which is allocated on the stack by getdeadletter() and which
would then be used after getdeadletter() has returned.

Reported by:	Coverity
CID:		1199383
MFC after:	1 week
2016-05-13 06:15:05 +00:00
Jilles Tjoelker
ae7d5745cd mail: Don't truncate mtime of mailbox to microseconds. 2016-04-17 20:00:24 +00:00
Pedro F. Giffuni
0bfdca975c Fix naive use of ftell(3).
Secure coding practices, FIO19-C.
2016-02-16 21:39:19 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Baptiste Daroussin
f41337c150 Add const to the copyright variable
Bump WARNS to level 2
2015-06-06 13:13:39 +00:00
Simon J. Gerraty
9268022b74 Merge from head@274682 2014-11-19 01:07:58 +00:00
Pedro F. Giffuni
0fa46a4231 Always check the limits of array index variables before using them.
Obtained from:	DragonFlyBSD
MFC after:	1 week
2014-08-21 02:40:33 +00:00
Simon J. Gerraty
fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00
Simon J. Gerraty
76b28ad6ab Updated dependencies 2014-05-10 05:16:28 +00:00
Simon J. Gerraty
d1d0158641 Merge from head 2013-09-05 20:18:59 +00:00
Kevin Lo
ed74b69c2d Remove unnecessary cast to pid_t. 2013-07-04 03:24:58 +00:00
Simon J. Gerraty
69e6d7b75e sync from head 2013-04-12 20:48:55 +00:00
Simon J. Gerraty
7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
Dimitry Andric
ca83b97532 Fix undefined behaviour in usr.bin/mail/util.c.
Reported by:	deeptech71@gmail.com
MFC after:	3 days
2013-02-15 23:59:57 +00:00
Simon J. Gerraty
23090366f7 Sync from head 2012-11-04 02:52:03 +00:00
Ed Schouten
902d9eafbf Rework all non-contributed files that use `struct timezone'.
This structure is not part of POSIX. According to POSIX, gettimeofday()
has the following prototype:

	int gettimeofday(struct timeval *restrict tp, void *restrict tzp);

Also, POSIX states that gettimeofday() shall return 0 (as long as tzp is
not used). Remove dead error handling code. Also use NULL for a
nul-pointer instead of integer 0.

While there, change all pieces of code that only use tv_sec to use
time(3), as this provides less overhead.
2012-09-01 14:45:15 +00:00
Marcel Moolenaar
7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Eitan Adler
35f8ab70be Fix likely race condition if wait_child() is interrupted by sigchild()
PR:		bin/102834
Submitted by:	Andreas Longwitz <longwitz@incore.de>
Approved by:	cperciva
MFC after:	2 weeks
2012-05-30 03:55:44 +00:00
Kevin Lo
a3a2bf4b67 fgets(3) returns a pointer, so compare against NULL, not integer 0. 2012-01-13 06:51:15 +00:00
Ulrich Spörlein
389ae6c65d Touch up some more small typos missed in the previous round.
Reported by:	Ben Kaduk <minimarmot@gmail.com> et al.
2012-01-05 21:36:45 +00:00
Ulrich Spörlein
487ac9ac21 Spelling fixes for usr.bin/ 2011-12-30 11:02:40 +00:00
Dimitry Andric
081aa5169d In usr.bin/mail/cmd1.c, use the correct printf length modifier for a
ptrdiff_t.  In usr.bin/mail/main.c, cast a field width to int.

MFC after:	1 week
2011-12-17 16:30:42 +00:00
Ed Schouten
f6ab8089c6 Replace __const by const in all non-contributed source code.
As C1X is close to being released, there is no need to wrap around a
feature that is already part of C90. Most of these files already use
`const' in different placed as well.
2011-12-13 13:32:56 +00:00
Maxim Konovalov
50ca181e5d o Fix -u flag description: it takes a username as an argument.
PR:		docs/153416
Submitted by:	Eitan Adler
MFC after:	1 week
2010-12-25 17:35:30 +00:00
Philippe Charnier
6d8484b0d0 Add __unused. Ansi prototypes. 2010-12-19 16:25:23 +00:00
Philippe Charnier
640e31deaf Add __unused. Ansi prototypes. 2010-12-19 14:18:07 +00:00
Joel Dahl
da52b4caaf Remove the advertising clause from UCB copyrighted files in usr.bin. This
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change

Also add $FreeBSD$ to a few files to keep svn happy.

Discussed with:	imp, rwatson
2010-12-11 08:32:16 +00:00
Ulrich Spörlein
cded07a878 Move most of the remaining USD/PSD/SMM papers into share/doc 2010-12-04 10:11:20 +00:00
Ulrich Spörlein
a1d170a0b6 mail(1) misses addresses when replying to all
There's a parsing error for fields where addresses are not separated by
space. This is often produced by MS Outlook, eg.:
Cc: <foo@bar.com>,"Mr Foo" <foo@baz.com>

The following line now splits into the right tokens:
Cc: f@b.com,z@y.de, <a@a.de>,<c@c.de>, "foo" <foo>,"bar" <bar>

PR:		bin/131861
Submitted by:	Pete French <petefrench at ticketswitch.com>
Tested by:	Pete French
Reviewed by:	mikeh
MFC after:	2 weeks
2010-05-27 12:59:49 +00:00
Ed Schouten
99742a231f Change all our own code to use st_*tim instead of st_*timespec.
Also remove some local patches to diff(1) which are now unneeded.
2010-03-28 13:16:08 +00:00
Ed Schouten
b7946da96b Build usr.bin/ with WARNS=6 by default.
Also add some missing $FreeBSD$ to keep svn happy.
2010-01-02 10:27:05 +00:00
Ed Schouten
0bee4c2c74 Rename mail(1)'s aux.c to util.c.
The name `aux' is reserved on Windows file systems. aux.c in the mail(1)
directory contains some random utility functions. I'm renaming this file
to util.c to make it possible to check out this directory on Windows.

MFC after:	1 month
2009-01-16 15:00:30 +00:00
Diomidis Spinellis
e7d538131d Use static storage-class specifier where appropriate.
Found by: CScout
2007-11-08 11:13:03 +00:00
Diomidis Spinellis
c14530c701 Make function's definition follow its declared visibility.
Found by: CScout
2007-11-08 09:09:02 +00:00
Maxim Konovalov
7f61ad1c2b o Really commit typo fixes to HEAD.
PR:		docs/110809
Submitted by:	naddy
2007-03-25 18:37:59 +00:00