Commit Graph

2168 Commits

Author SHA1 Message Date
Stefan Farfeleder
aafd6a87a6 The exit status of a case statement where none of the patterns is matched
is supposed to be 0, not the status of the previous command.

Reported by:	Eygene Ryabinkin
PR:		116559
Approved by:	re (gnn)
2007-10-04 16:14:48 +00:00
Kevin Lo
c577145195 Use owner name and owning group name instead of uid and gid
for displaying the three-line comment header by default.

Reviewed by: kientzle
Approved by: re (bmah)
2007-09-19 02:04:47 +00:00
Jeff Roberson
b61ce5b0e6 - Move all of the PS_ flags into either p_flag or td_flags.
- p_sflag was mostly protected by PROC_LOCK rather than the PROC_SLOCK or
   previously the sched_lock.  These bugs have existed for some time.
 - Allow swapout to try each thread in a process individually and then
   swapin the whole process if any of these fail.  This allows us to move
   most scheduler related swap flags into td_flags.
 - Keep ki_sflag for backwards compat but change all in source tools to
   use the new and more correct location of P_INMEM.

Reported by:	pho
Reviewed by:	attilio, kib
Approved by:	re (kensmith)
2007-09-17 05:31:39 +00:00
Sean Farley
5b78c6c247 Take care that the input to setenv() may actually be a pointer straight
from environ; make a copy before manipulating it and passing it to
setenv().

Approved by:	wes
Approved by:	re (kensmith)
2007-07-06 04:04:58 +00:00
Sean Farley
2966d28c32 Significantly reduce the memory leak as noted in BUGS section for
setenv(3) by tracking the size of the memory allocated instead of using
strlen() on the current value.

Convert all calls to POSIX from historic BSD API:
 - unsetenv returns an int.
 - putenv takes a char * instead of const char *.
 - putenv no longer makes a copy of the input string.
 - errno is set appropriately for POSIX.  Exceptions involve bad environ
   variable and internal initialization code.  These both set errno to
   EFAULT.

Several patches to base utilities to handle the POSIX changes from
Andrey Chernov's previous commit.  A few I re-wrote to use setenv()
instead of putenv().

New regression module for tools/regression/environ to test these
functions.  It also can be used to test the performance.

Bump __FreeBSD_version to 700050 due to API change.

PR:		kern/99826
Approved by:	wes
Approved by:	re (kensmith)
2007-07-04 00:00:41 +00:00
Ken Smith
0c0146f019 Don't include encryption features of ed(1) when building for the
"rescue media" bundled with releases.

Suggested by:	ru
Approved by:	re (hrs)
2007-07-02 14:00:25 +00:00
Remko Lodder
a1f6cb79d9 Correct the referenced securelevel document, it's now securelevel 7.
Pointed out by:	ru
2007-06-02 20:15:59 +00:00
Pawel Jakub Dawidek
2bb428228e Fix probably copy&paste from chmod(1) - we change file flags here, not mode. 2007-05-28 04:23:09 +00:00
Brian Somers
367787a3c6 Remove unnecessary free argument casts.
Don't abuse arcname's constness.
2007-05-25 17:53:38 +00:00
Ralf S. Engelschall
f2703795ca Cleanup pax(1) sources a little bit while I poked around in them:
- remove a superfluous doubled trailing semicolon.
- remove the extra void casts on calls to void-function free(3).
2007-05-24 06:44:37 +00:00
Colin Percival
c28f49d439 In the error handling path, don't call close(fd) if the error we're
handling is that fd = open(foo) is -1.  This bug is harmless since
close(-1) just returns an error (which the code ignores).

Found by:	Coverity Prevent(tm)
CID:		1503 (in userland test run)
2007-05-22 04:21:00 +00:00
Mark Peek
59dfb2db03 Work around a vendor issue that was causing the builtin malloc to be
used instead of the system malloc.

Submitted by:	ume
2007-05-16 21:22:38 +00:00
Pav Lucistnik
a3f58dae59 Replace a fairly opaque sentence with a much clearer wording from NetBSD.
PR:		docs/101330 (inspired by)
Submitted by:	Peter Gildea <peter@gildea.com>
Obtained from:	NetBSD
2007-05-12 22:18:27 +00:00
Andrey A. Chernov
ba174a5e38 Back out all POSIXified *env() changes.
Not because I admit they are technically wrong and not because of bug
reports (I receive nothing). But because I surprisingly meets so
strong opposition and resistance so lost any desire to continue that.

Anyone who interested in POSIX can dig out what changes and how
through cvs diffs.
2007-05-01 16:02:44 +00:00
Andrey A. Chernov
c7368c3569 Simplify previous fix and disallow VTEXTFIXED direct pass for putenv() too,
just use savestr()
2007-04-30 15:01:33 +00:00
Andrey A. Chernov
7071e63df7 Put some safeguards:
1) Under POSIX unsetenv("foo=bar") is explicit error and not equal
to unsetenv("foo")
2) Prepare for upcomig POSIXed putenv() rewrite: make putenv() calls
portable and conforming to standard.
2007-04-30 11:44:42 +00:00
Andrey A. Chernov
7c450364bc Eliminate error with -W* strict flags and make putenv() calls conforming to
standard in the same way as f.e. gcc internal portable code does.
2007-04-30 04:29:17 +00:00
Pawel Jakub Dawidek
0c6b66bd70 Move uuidgen(1) from /usr/bin/ to /bin/. It will be used in rc.d/hostid
script, which will be executed before /usr/ mount.

Reviewed by:	mlaier, rink, brooks, rwatson
2007-04-09 19:16:48 +00:00
Alexander Kabaev
2897dce81d getblocksize expects pointer to long as a second argument, not
a pointer to u_long.
2007-04-06 15:36:43 +00:00
Mark Peek
15aaece8bd Build updates for tcsh-6.15.00 import.
Reviewed by:	ume
Reminded by:	Divacky Roman
MFC after:	1 week
2007-03-11 22:41:19 +00:00
Will Andrews
27f8233569 Fix a bug where the mutual exclusivity of the -l and -t options is not
recognized properly if -l is specified first.

PR:			bin/105721
MFC after:	1 week
2007-03-08 06:10:17 +00:00
Ruslan Ermilov
9f3cef9108 Fix markup. 2007-03-04 19:52:07 +00:00
Ruslan Ermilov
0dc55f7681 Fix markup. 2007-03-04 09:15:12 +00:00
Ruslan Ermilov
975ab35963 Fix markup. 2007-02-28 10:29:48 +00:00
Ruslan Ermilov
6f000336cd Fix markup. 2007-02-27 11:25:58 +00:00
Kirk McKusick
b5ea8f4cbc Implement the -h flag (set an ACL on a symbolic link).
Before this fix the -h flag was ignored (i.e. setfacl
always set the ACL on the file pointed to by the symbolic
link even when the -h flag requested that the ACL be set
on the symbolic link itself).
2007-02-26 00:42:17 +00:00
Ceri Davies
e1854a84ad Correct typos containing my login name (plus one more in expr.y).
Found courtesy of a recursive grep in the wrong directory.
2007-02-18 19:48:59 +00:00
Stefan Farfeleder
d92e35fd5f Use eaccess() instead of access() for the type builtin, like we do for the
test builtin.

Submitted by:	Martin Kammerhofer
2007-01-18 22:31:22 +00:00
Stefan Farfeleder
f30842ba79 Return an error status (127) from the builtins 'type' and 'command' (with
either -v or -V) if a file with a slash in the name doesn't exist (if there is
no slash we already did that).

Additionally, suppress the error message for command -v for files with a slash.

PR:		107674
Submitted by:	Martin Kammerhofer
2007-01-11 00:19:00 +00:00
Ruslan Ermilov
b3c71457fa Fix markup. 2006-12-27 12:14:56 +00:00
Ruslan Ermilov
1ee7aa6068 More markup fixes. 2006-12-27 11:28:00 +00:00
Ruslan Ermilov
c92beb6d39 Fix markup. 2006-12-27 11:19:06 +00:00
Ruslan Ermilov
88b0915eb1 Give a hint to the reader as to what the "whiteout" actually means. 2006-12-26 13:57:40 +00:00
Ruslan Ermilov
ca3f81d885 Fix markup, add the EXIT STATUS section. 2006-12-26 13:44:41 +00:00
Ruslan Ermilov
d2b53efbb9 One more nit. 2006-12-23 09:25:23 +00:00
Ruslan Ermilov
17bba29b9b Fix markup. 2006-12-23 09:22:06 +00:00
Ruslan Ermilov
dd8f42dc83 - Mention umask(2) when first referring to it.
- Add missing markup.

Submitted by:	Eugene Grosbein <eugen@grosbein.pp.ru>
2006-12-22 07:28:38 +00:00
Ruslan Ermilov
b35e435f6e Use a standard section name. 2006-12-18 15:45:01 +00:00
Ruslan Ermilov
7eb5016ab5 Simplify some markup. 2006-12-14 10:42:46 +00:00
Tim Kientzle
8abbcd2910 Style(9) fixes, thanks to Ruslan. 2006-12-08 07:47:08 +00:00
Tim Kientzle
a426a2865c Support the "-f" option by simply ignoring it.
This allows script compatibility with Linux, whose
"hostname" is the same as BSD "hostname -s".
With this change, "hostname -f" is the same on
both systems.

MFC after: 7 days
2006-12-08 07:19:51 +00:00
Ruslan Ermilov
0f0a3e4f82 Once upon a time, the hostname was being set in the /etc/netstart,
which can be called a "network initialization script", now that it
is set in /etc/rc.d/hostname, "network" sounds confusing, so remove
it.
2006-12-05 12:09:50 +00:00
Ruslan Ermilov
c65bb135d9 Fix some of the alignment warnings on ARM. 2006-11-27 22:17:11 +00:00
Stefan Farfeleder
bb4f73cac6 Fix expanding of quoted positional parameters in case patterns.
Obtained from:	NetBSD (expand.c 1.58 and 1.59)
Submitted by:	Paul Jarc
PR:		56147
2006-11-07 22:46:13 +00:00
Stefan Farfeleder
62addaefc9 When parsing an invalid parameter expansion (eg. ${} or ${foo@bar}) do not
issue a syntax error immediately but save the information that it is erroneous
for later when the parameter expansion is actually done.  This means eg. "false
&& ${}" will not generate an error which seems to be required by POSIX.
Include the invalid parameter expansion in the error message (sometimes
abbreviated with ... because recovering it would require a lot of code).

PR:		105078
Submitted by:	emaste
2006-11-05 18:36:05 +00:00
Ceri Davies
b873ae5ca9 Fix typo. 2006-11-02 19:10:05 +00:00
Xin LI
86da4a5eea Correct a security issue introduced in previous commit:
instead of removing the file and issue a warning about
the removal, do not do any operation at all in case -P
is specified when the dinode has hard links.

With -f and -P specified together, we assume that the
user wants rm to overwrite the contents of the file
and remove it (destroy the contents of file but leave
its hard links as is).

The reason of doing it this way is that, in case where
a hard link is created by a malicious user (currently
this is permitted even if the user has no access to the
file).  Losing the link can potentially mean that the
actual owner would lose control completely to the user
who wants to obtain access in a future day.

Discussed with:	Peter Jermey
2006-10-31 02:22:36 +00:00
Xin LI
0b6f55b77c Be more reasonable when overwrite mode is specified while there
is hard links.  Overwritting when links > 1 would cause data
loss, which is usually undesired.

Inspired by:	discussion on -hackers@
Suggested by:	elessar at bsdforen de
Obtained from:	OpenBSD
2006-10-30 03:32:09 +00:00
Tom Rhodes
f3955abb6f Wording nits. 2006-10-27 08:26:24 +00:00
Tom Rhodes
6138defa43 Flesh out the compatibility section a little bit. Bump doc date. 2006-10-24 18:42:42 +00:00