Commit Graph

351 Commits

Author SHA1 Message Date
mpp
c785109c06 Fix several problems with mkdir:
1)  Fix mkdir -p to exit with the proper exit status and issue an error
    message if it was unable to create all of the specified directories
    and they did not previously exist.  POSIX says:

    The mkdir utility shall exit with one of the following values:

    0  All the specified directories were created successfully or the
       -p option was specified and all the specified directories now
       exist.

    E.g.

    % mkdir -p /var/mkdir
    mkdir: /var/mkdir: Permission denied

    % touch /tmp/file
    % mkdir -p /tmp/file/dir
    mkdir: /tmp/file: Not a directory

    Previously the above examples would exit with a zero exit status
    and no error message.  Something like the following run as a
    normal user will still not produce an error:

    % id
    uid=629(mpp) gid=629(mpp)....
    % mkdir -p /usr/local/etc
    % ls -ld /usr/local/etc
    drwxr-xr-x  4 bin  bin  512 Dec 26 14:55 /usr/local/etc/

2)  Cleaned up the mode handling to be more efficient when multiple
    directories are being created.

3) Fixed a problem where directories could be created with the wrong mode
   if the the -p option was specified and the build() routine returned
   and error.  It would leave the umask set incorrectly at this point.

4) Removed an unused variable.

Closes PR# 2304.
1997-04-01 23:46:22 +00:00
imp
141381e1cb compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.
1997-03-29 04:34:07 +00:00
imp
054f35c222 compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.
1997-03-28 15:24:41 +00:00
obrien
4c9cebcc51 make usage() and SYNOPSIS agree with each other and add missing options
documented in the DESCRIPTION section.
1997-03-26 17:48:40 +00:00
imp
a1b85d3196 Use mkstemp rather than mktemp to prevent races.
Obtained from: OpenBSD
1997-03-24 05:45:29 +00:00
bde
55186ebb5b Merged from Lite2. The -t option is now handled better. The only visible
change should be that the usage message now actually matches the man page.
1997-03-13 17:41:37 +00:00
bde
9924e3c671 Merged from Lite2. The man page no longer attempts to list all the
vfs types.

Fixed ordering of FreeBSD `k' option in synopsis.
1997-03-13 17:32:39 +00:00
bde
2eaf7f70e5 Merge from Lite2. Straightforward changes. 1997-03-13 17:29:08 +00:00
mpp
c0650ef68d Correct the self reference in the description of the "tabs" option.
It should really refer to "oxtabs".

Obtained from: NetBSD-bugs mailing list PR# 3320
1997-03-12 15:59:22 +00:00
guido
bb4c208876 Fix buffer overflow 1997-03-10 19:52:12 +00:00
guido
2f74bc969e This is a funny one: df for a device that was not mounted used to fail
for root only.
1997-03-10 19:39:43 +00:00
guido
b27e3f2aef Fix buffer overflow (probably unexploitable). 1997-03-10 19:10:08 +00:00
guido
7645c8bdd7 Make mv more robust. A race has been fixed, as well as an extra warning
added when sbits are cleared.
Fixes PR 1351 and 1377 (I hope).
1997-03-08 16:05:44 +00:00
mpp
fc6cc96bc4 Typo fix. 1997-03-07 01:58:56 +00:00
joerg
cf12351a85 Acitvate chio(1). 1997-03-06 15:30:53 +00:00
joerg
8686d8e4ac This commit was generated by cvs2svn to compensate for changes in r23449,
which included commits to RCS files with non-trunk default branches.
1997-03-06 15:30:06 +00:00
joerg
22817fb6a1 Import Jason Thorpe's contribution for an updated SCSI media changer
device (now, finally!).
1997-03-06 15:30:06 +00:00
ache
264293aa5c Big usernames fixes 1997-03-04 00:33:56 +00:00
ache
648176d7b8 Use MAXLOGNAME-1 for width because MAXLOGNAME includes NUL 1997-03-03 08:20:28 +00:00
mpp
75dbc4794f Add a missing period in the -o option description.
Document the depreciated -g option.

Inspired by: OpenBSD PR# 119
1997-02-25 00:26:53 +00:00
peter
83b3c2c161 Revert $FreeBSD$ to $Id$ 1997-02-22 14:13:04 +00:00
mpp
ebf34cb494 Use the .Bx macro in the HISTORY section. 1997-02-19 07:14:30 +00:00
obrien
78b845fbdb Add history section. Follows chflags(2). 1997-02-19 00:32:35 +00:00
jkh
f8cd22bf39 Include <ufs/ufs/ufsmount.h>. 1997-02-17 05:26:08 +00:00
steve
45d17b0093 Fix a expansion bug that caused the result of echo $((1 << 30))
to get truncated.

Submitted by: bde
1997-02-16 01:54:19 +00:00
alex
a3118e8c68 Sweep through the tree fixing mmap() usage:
- Use MAP_FAILED instead of the constant -1 to indicate
    failure (required by POSIX).
  - Removed flag arguments of '0' (required by POSIX).
  - Fixed code which expected an error return of 0.
  - Fixed code which thought any address with the high bit set
    was an error.
  - Check for failure where no checks were present.

Discussed with:	bde
1997-01-16 21:58:40 +00:00
jkh
808a36ef65 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
wosch
71f5160702 Sort cross references. 1997-01-13 00:25:51 +00:00
mpp
00e77cfa21 Minor mdoc cleanup. 1997-01-11 19:47:07 +00:00
mpp
b6cd43973e Add a blurb describing the fact that ls will print the
year in place of the hour/minute fields if the time is
more than 6 months in the past or future.

Also some minor mdoc cleanup.
1997-01-11 19:24:22 +00:00
mpp
290bb61e14 Make ls include the year when displaying times that are more than
6 months into the future.  Closes PR# 1657.

Submitted by:	Sakari Jalowaara <sja.home.tekla.fi>
1997-01-11 19:15:53 +00:00
steve
774419801b Fix a problem that caused some foreground pipelines to die with:
tcsetpgrp failed, errno=1

Discovered and Reviewed by: joerg
1997-01-06 01:26:44 +00:00
steve
5936b56fef Make sh(1) think and be in the same place at the same time. This closes
PR#2331: strange output of sh's pwd on symlinked directories.
1997-01-04 19:14:29 +00:00
wosch
b772239a12 add some string examples, eg. test "" -o "" 1996-12-28 13:31:29 +00:00
ache
a7a2d1e16c Use strcoll instead of strcmp for file names comparation
Should be in 2.2
1996-12-28 03:46:27 +00:00
steve
9079a13346 Fix handling of -o and -a operators in the 3 argument case.
Submitted by: Tom Rush <tarush@mindspring.com>
1996-12-25 00:08:10 +00:00
steve
3d5f13bf93 With these changes sh(1)'s trap command should be POSIX-compliant,
while remaining (becoming :) compatible with other popular shells.
Specifically these changes include:

1) Implement 'trap -l' to get a list of valid signals names.  This
   is useful if you wanted to do something like reset all signal
   handlers to there defaults values, in which case something like
   this will do the trick.

	trap `trap -l`

2) Reformat the output of 'trap' so it can be saved and later eval'd
   to restore the saved settings.

3) Allow the use of signal names as well as signal numbers.

4) Fix trap handling of SIGCHLD so that commands like the following
   (albeit, contrived) won't cause sh(1) to recurse ad infinitum.

	trap uname 0 20

5) Make variables static that are used only in trap.c.

6) Minor 'style(9) police' mods.
1996-12-24 23:59:53 +00:00
steve
dfe5d3d364 Oops, it needs little more caulk to get it right. 1996-12-23 22:29:03 +00:00
steve
6da76fc1dd Apply a little dab of bit caulk to keep those beggars
from leaking out.

Noticed by: bde
1996-12-23 22:16:35 +00:00
steve
c9faf62a80 Don't use _POSIX_PATH_MAX to limit the size of the path, instead
use 'getcwd(NULL, 0)' just as pwd(1) does.

Suggested by: bde
1996-12-23 05:31:48 +00:00
steve
cd89de39c0 Make sh(1) a little braver in the face of adversity. sh(1)
now handles the getpwd() init problem the same way as bash
and ksh do.  Also while I was in here, I cleaned up the format
a little, removed some unnnecessary #if SYMLINKS cruft, and
changed the pwd builtin to use getcwd(3) as Joerg suggested.
1996-12-21 22:09:40 +00:00
steve
705d04d9c4 This doesn't change any behavior, but may be a slight
optimization.  (num-- > 0) --> (--num >= 0).

Obtained from: NetBSD
1996-12-21 15:16:32 +00:00
steve
1b5cb4ee0a Remove extra #undef. 1996-12-21 14:57:38 +00:00
steve
f831af1d64 Fix a problem caused by finger failure on my part. The builtin
getopts should now work as expected.  This fix was in the NetBSD
code that I was merging from but missed getting into FreeBSD's
version because of 'drain bamage' on my part.

Submitted by:	NetBSD, joerg
1996-12-21 13:21:57 +00:00
steve
c58aca035e Merge in NetBSD mods and -Wall cleaning.
Obtained from: NetBSD, me
1996-12-14 06:20:03 +00:00
steve
a958416f1b -Wall cleaning. 1996-12-14 06:16:51 +00:00
steve
1c6d77453c Cleanup man page and -Wall cleaning. 1996-12-14 06:14:32 +00:00
steve
bf5151c8fc -Wall cleaning and implement -p commandline option.
-p mod obtained from: NetBSD
1996-12-14 06:13:51 +00:00
steve
2aae101b54 Merge Lite2 mods, and -Wall cleaning. Unimplemented undelete(2)
cruft is protected by a #ifdef (BSD4_4_LITE) that should be
removed when this is supported by the kernel.
1996-12-14 06:11:53 +00:00
steve
c5d0f9cb39 -Wall cleaning. 1996-12-14 06:08:03 +00:00