This allows other programs to link in against ls (e.g, ftpd), without having
to have hacks to deal with multiple main()s.
Yes, I know this is ugly. The clean alternative (move lots of this
into libutil, yada yada yada) isn't fun, and the effort probably isn't
justified...
buffer size of zero if stdout has a block size of 0.
The command `rsh <host> cat <files>' gives no output and no error.
- Allocate a minimum of BUFSIZ bytes for buffer.
- Use a static buffer if either `fstat' or `malloc' fails.
- Do the allocation once since stdout will not change block size.
fstatfs() on the open file to verify that no intruder has mounted
something on portions of /proc. This will catch, for instance,
"mount_null /tmp /proc/1378". We already do 5 syscalls per
process, so one more won't hurt :) ... and safety is better than
performance when ps is otherwise broken.
- Also added a few close()'s at early returns, to avoid chewing up fd's.
fallback method is used, as the results could be untrustworthy if an
intruder is present. It is highly likely that NetBSD-1.5 will have
an improved kvm interface for reading process information, at which
point this code can be garbage-collected. Also added a word to the
man page -x option description while I was here.
to what the manpage and POSIX say) copied as symlinks, even without -R.
Return ENOENT instead. Closes PR 6975 by Johan Danielsson <joda@pdc.kth.se>.
From FreeBSD: return correct error message if source directory is
unreadable; remove unnecessarily included headers.
string legally (it strdup()s the argument). How pax-as-tar `-o' ever
worked without a coredump is beyond me...
Also modify pax-as-tar `-o' to do three things, which depend on the
create/extract mode:
- write V7 format archives (which, though part of GNU tar, actually
goes along with the following point--after all, old pax-as-tar created
V7 archives by default);
- write archives with "write_opt=nodir", as pax already did, and as
specified by 4.2BSD;
- extract archives with owner/group set to invoking user, as specified
by SUS.
even if the specified file is not in the PATH.
This change enforces security and makes it conform to POSIX.
Closes PR #6794.
I thought Christos committed this but not appeared yet. :)
The setstackmark()/popstackmark() pair in dotcmd(), used for freeing
stack storage possibly allocated by find_dot_file(), is redundant for now
since dotcmd() is surrounded by another pair in evalcommand().
This redundancy, however, may help future modifications
(suggested by Christos).
The problem was that system calls got restarted after a signal,
instead of returning EINTR. Thus the read builtin, had no way to
know that a signal occured that could change the course of execution.
Since the code has sprinkled checks for EINTR all over the place,
it is supposed to work properly with non restartable syscalls.
The fix is to use siginterrupt(signo, 1), before setting a signal
handler, to make sure that system calls don't get restarted.
Rewrite man page in mandoc format rather than nasty man format.
Fix a ton of parsing errors, and generate proper .Xr's.
document all known environment variables.
suggest ksh rather than bash.
The last two fix PR #1966. Wheee!
Somebody with access to the POSIX spec needs to go in here, and document
our adherence, or lack thereof.
from Brian C. Grayson <bgrayson@marvin.ece.utexas.edu> in [bin/3932]
* don't depend on a fallthrough in one case; explicitly return like
all other cases.
* include "stat_flags.h" instead of "ls.h" and "extern.h"; other
programs use this file and don't need the other cruft.
We need not wait for a while any longer after pressing ESC or ^D.
Problem description:
If a user types characters during performing completion (ESC)
or listings (^D), the chars are inserted at weird position of
the command line.
This makes the command line unusable and irritates the user.
I noticed this on 386BSD(98), probably six years ago.
This change fixes the bug by implementing salvage of the characters.
The salvaged chars are added at the end of the command line.
An extra ioctl(FIONREAD) is required to work-around a glitch on
kernel tty driver.
even if mkdir(2) failed. At best this caused two (different)
error messages to be printed. At worst, it changed the mode of
an existing file/directory.
It's suppsed to remove the file and then copy, which it wasn't doing.
But no wait, it turns out that the described behaviour in the manual doesn't
agree with POSIX. So we change the above fix and the manual to "try copy, and
if fail, try remove, then copy".
Fix bug where "cp -R" didn't work on read-only directories:
It would make the directory, set the mode, and not be able to write files into it.
Don't bother mmap()ing files of zero length. Was a workaround for a bug in Rhapsody
mmap(), which didn't get along with such files, but makes sense anyway.
Fix race condition where "cp -p" would set the mod time of a file before close()ing
the file, which would update the mod time and therefore screw up the "-p" idea,
except, of course, while running in gdb, which sucked.
Add -f option to usage message in binary and man page. Already documented in man page.
such as sh -c 'echo `echo foo`' .
The memory allocated with ckmalloc() at
parser.c:1349:readtoken1() (search for "done:" label)
was never freed.
I changed this to use 'string stack' framework of Ash.
Note that a string on string stack is properly freed on
exception and end of command parsing, and no explicit free
or signal handlings required.
See TOUR for an overview, and memalloc.[ch] for details
of string stack.
and must be freed to avoid memory leaks if called repeatedly.
The leaks occured on symbolic umask command, such as "umask go-w",
which is undocumented.
It wasn't working anyway, although that could have been fixed by moving it
down below the .include <bsd.prog.mk> line.
It's not completely clear that this usage of %y is in fact y2k-safe, it
seems safer for now to have a single XXX option in bsd.sys.mk, and we need
to rev this anyway for -Wno-uninitialized