Commit Graph

8920 Commits

Author SHA1 Message Date
Andrey A. Chernov
68910e7a67 Use arc4random_uniform(3) 2008-08-07 22:22:41 +00:00
Edwin Groothuis
8ad0fbc8a1 - acificfrancexchange -> pacificfrancexchange
- Add comments about the pegged currencies.

Submitted by:	GeJ on #bsdports
2008-08-07 05:35:01 +00:00
Edwin Groothuis
5a97b29aa5 Update the units library file.
- Merge changes from NetBSD and OpenBSD.
- Add the Euro as a primitive unit, add old converted currency and
  pegged currency (Obtained from Wikipedia)
- Rename "dollar" to "usdollar" as primitive unit, remove non-pegged
  currency and add pegged currency (Obtained from Wikipedia)
- Updated the accuracy of a lot of constants (Obtained from Wikipedia)

PR:		bin/106545 bin/88252
Submitted by:	trasz<trasz@pin.if.uz.zgora.pl>, J Vinopal <banshee@abattoir.com>
Approved by:	bde@ (mentor)
MFC after:	1 week
2008-08-07 00:14:56 +00:00
Edwin Groothuis
0d724b8765 Move functions which are only locally used into their C files and
make them static.

usage() in calendar.c
event_*() in io.c

PR:		bin/118644
Approved by:	bde@ (mentor)
2008-08-05 08:16:37 +00:00
Edwin Groothuis
35304a1641 style(9)ify usr.bin/calendar
PR:		bin/118644
Approved by:	bde@ (mentor)
MFC after:	1 week
2008-08-05 08:11:54 +00:00
Colin Percival
80d61a6a48 Mark functions as __dead2 in order to help the LLVM static checker
understand which code paths aren't possible.

Reported by:	edwin
2008-08-04 07:36:53 +00:00
Colin Percival
d59e8ae886 Don't close file descriptor number <whatever random garbage was on the
stack>.

Found by:	LLVM/Clang Static Checker
MFC after:	1 week
2008-08-04 06:48:54 +00:00
Colin Percival
5fe69bb518 Setting a variable to the same value twice doesn't actually make it
more likely to have the right value.  Remove superfluous assignments.

Found by:	LLVM/Clang Static Checker
2008-08-04 06:39:52 +00:00
Colin Percival
f9bcf9cabf Mark functions as __dead2 in order to help the LLVM static checker
understand which code paths aren't possible.

This commit eliminates 117 false positive bug reports of the form
"allocate memory; error out if pointer is NULL; use pointer".
2008-08-04 01:25:48 +00:00
Xin LI
61328d7a97 Make quota(1) to compile with WARNS=6:
- ANSI'fy showrawquotas().
 - Shut up GCC by initializing bgrace and igrace.  The situation
   that caused the GCC warning can never happen though.
2008-08-04 00:43:49 +00:00
Olivier Houchard
049aa2e813 ctime() expects a time_t, but qup->dqblk.dqb_btime is an int32_t, so for
big endian platforms where time_t is 64bits (ie armeb and sparc64), it will
be a problem.
Use a temporary time_t to work around this.

Submitted by:	Matthew Luckie <mjl AT luckie DOT org dot nz>
MFC after:	3 days
2008-08-03 20:36:40 +00:00
Edwin Groothuis
5f5be9e857 calendar.holiday: Buinea-bissau should be Guinea-Bissau
PR:		conf/126199
Submitted by:	comet--berkeley (aka Pablo Picasso) <comet@transbay.net>
Approved by:	bde@
2008-08-03 09:21:47 +00:00
John Baldwin
52122f3139 A few style and whitespace fixes.
Submitted by:	bde
2008-08-02 12:04:59 +00:00
David Schultz
9d65050e7b POSIX says that octal escapes have the format \ddd in the format string,
but \0ddd in a %b argument, with a length restriction of 3 octal digits
in either case. This seems silly, but it needs to be right so it's possible
to write an octal escape followed by an ordinary digit. Solaris printf(1)
and GNU printf(1) also behave this way.

Example: "printf '\0752'" now produces "=2" instead of garbage.
2008-08-02 06:02:02 +00:00
John Baldwin
e68ed79390 Tweak the support for using ldd on 32-bit objects a bit further.
Specifically, build a 32-bit /usr/bin/ldd32 on amd64 which handles 32-bit
objects.  Since it is a 32-bit binary, it can fork a child process which
can dlopen() a 32-bit shared library.  The current 32-bit support in ldd
can't do this because it does the dlopen() from a 64-bit process.  In order
to preserve an intuitive interface for users, the ldd binary automatically
execs /usr/bin/ldd32 for 32-bit objects.  The end result is that ldd on
amd64 now transparently handles 32-bit shared libraries in addition to
32-bit binaries.

Submitted by:	ps (indirectly)
2008-08-01 21:52:41 +00:00
Dag-Erling Smørgrav
d8984f48cb Try to make this code slightly less painful to read. 2008-07-31 17:15:21 +00:00
Ed Schouten
40e761838e Add POSIX -p flag to make(1).
This article [1] describes the -p flag for make(1):

	Write to standard output the complete set of macro definitions and
	target descriptions. The output format is unspecified.

We already support a similar flag (-d g1), but unlike -p, it still
executes commands. Our implementation just turns it into -d g1, but also
sets flag `printGraphOnly', which will cause make(1) to skip execution.

[1] http://www.opengroup.org/onlinepubs/009695399/utilities/make.html

Reviewed by:	imp
PR:		standards/99960
2008-07-30 21:18:38 +00:00
Tim Kientzle
979b646f30 MfP4: Preserve permissions by default.
In particular, this fixes the oddity that -dumpl would apply
umask to copied dirs (which are created in the target tree)
but not to "copied" files (which are only linked).  After
this change:

$ ls -ld a a/b a/b/c
d--x-w-r--  3 tim  tim  512 Jul 29 20:08 a
drwxr----x  3 tim  tim  512 Jul 29 20:09 a/b
dr----x-w-  2 tim  tim  512 Jul 29 20:09 a/b/c
$ (echo a; echo a/b; echo a/b/c) | cpio -dumpl o
$ cd o
$ ls -ld a a/b a/b/c
d--x-w-r--  3 tim  tim  512 Jul 29 20:08 a
drwxr----x  3 tim  tim  512 Jul 29 20:09 a/b
dr----x-w-  2 tim  tim  512 Jul 29 20:09 a/b/c
2008-07-30 03:35:45 +00:00
Maksim Yevmenkin
f35a20921e Fix build 2008-07-29 21:20:03 +00:00
Maksim Yevmenkin
9b501d5ab1 Fix build 2008-07-29 17:02:00 +00:00
Tim Kientzle
b423c28f74 Add --no-preserve-owner, which seems to be required by some ports.
Thanks to: Erwin Lansing
2008-07-29 15:23:31 +00:00
Edwin Groothuis
bff7135050 Fix text in the comment why we check for ELF32_R_TYPE
Approved by:	bde@
MFC after:	2 days2 days
2008-07-28 12:49:16 +00:00
Ed Schouten
d693ac206e Fix a small typo in the procstat(1) manpage: messsage queue.
Approved by:	philip (mentor)
MFC after:	3 days
2008-07-28 08:01:24 +00:00
Simon L. B. Nielsen
1640935f0b - Fix mtree example so it works.
- Document --version.

Reviewed by:	kientzle
MFC after:	1 week
2008-07-26 17:22:40 +00:00
Philip M. Gollucci
fc2b30de6c Adding myself as a new ports committer
Reviewed by:    gabor (mentor)
Approved by:	araujo (mentor)
2008-07-23 01:37:04 +00:00
Xin LI
bf15662677 Sync with NetBSD's license changes. 2008-07-23 00:03:36 +00:00
Edwin Groothuis
8bd833fff8 After the commit of SVN rev 180236, wilko@ noticed that the approach
doesn't work on the Alpha platform: machine/elf.h doesn't include
sys/elf32.h there.

PR:		related to bin/124906
Approved by:	bde@
MFC after:	1 week
2008-07-21 02:13:14 +00:00
Xin LI
fffc0a1e59 Use %zd for size_t. With this gcore(1) is WARNS=6 clean. 2008-07-18 23:37:05 +00:00
Xin LI
c1613cd50a Indent the else path, reduce diff against OpenBSD. 2008-07-18 23:35:31 +00:00
Kevin Lo
068d36032a Fix a longstanding bug, from Otto Moerbeck:
if we're reducing a rule that has an empty
right hand side and the yacc stackpointer is pointing at the very
end of the allocated stack, we end up accessing the stack out of
bounds by the implicit $$ = $1 action

Obtained from:	OpenBSD
2008-07-18 15:05:14 +00:00
Philippe Charnier
dd99983988 add __unused to succeed at WARNS=6 2008-07-10 13:26:46 +00:00
Stacey Son
98ca2e9789 Added my birthday to the FreeBSD calendar.
Approved by:	jb (mentor)
2008-07-08 15:43:54 +00:00
Tim Kientzle
af03c60c06 Preserve ownership if cpio is run as root. 2008-07-06 16:39:18 +00:00
Colin Percival
a6d7fc3469 Move duplicated code from tar_mode_[cru] into archive_write.
Fix a bug I introduced 7 minutes ago: clean up properly from archive_write
if we exit the argv-handling loop due to -C not having an argument.
2008-07-05 08:10:55 +00:00
Colin Percival
d47b2ddb21 Use malloc in write_archive to allocate a 64kB buffer for holding file data
instead of using 64kB of stack space in copy_file_data and write_file_data.
2008-07-05 08:03:08 +00:00
Colin Percival
85f32b2087 Clean up write_entry by eliminating fd except in the #ifdef __linux block
where it is used. [1]

Don't leak file descriptors in write_entry_backend if archive_write_header
returns ARCHIVE_FAILED.

Found by:	Coverity Prevent [1]
2008-07-05 06:05:34 +00:00
Tim Kientzle
ba779d5afd bsdcpio is now at version 1.0.0. 2008-07-05 05:17:33 +00:00
Tim Kientzle
0d35b0da0c In -pl mode, only hardlink regular files. I need to test
other implementations, but it's clear that dirs and symlinks,
at least, shouldn't be hardlinked.
2008-07-05 05:16:23 +00:00
Tim Kientzle
2ebfcda850 Remove an unused define. 2008-07-05 05:15:07 +00:00
Colin Percival
9af6e14a8c Revert CVS revision 1.68; it is now possible for entry to be NULL at the end
of write_entry.  (This was perfectly safe, since archive_entry_free(NULL) is
a no-op, but adding the check back makes the style more consistent.)
2008-07-05 02:21:51 +00:00
Tim Kientzle
6481fd43de FreeBSD-CURRENT bsdtar is synched up with libarchive-portable 2.5.5. 2008-07-05 02:09:54 +00:00
Tim Kientzle
aec34fd22e Remove HAVE_STRUCT_STAT_ST_RDEV, as it's not used anywhere. 2008-07-05 02:09:13 +00:00
Tim Kientzle
f12440da1e Stop using the deprecated linux/ext2_fs.h. 2008-07-05 02:06:55 +00:00
Tim Kientzle
fe8c1d9768 Use %H:%M for strftime() time formatting instead of the non-portable %R. 2008-07-05 02:05:55 +00:00
Edwin Groothuis
fffd993df2 On 64 bit architectures, you can run 32 bit executables and the rtld can trace them, but ldd(1) doesn't know yet how to detect them:
[/] root@ed-exigent>ldd `which httpd`
    ldd: /usr/local/sbin/httpd: can't read program header
    ldd: /usr/local/sbin/httpd: not a dynamic executable

    But...

    [/] root@ed-exigent>LD_32_TRACE_LOADED_OBJECTS==1 `which httpd`
    libm.so.4 => /lib32//libm.so.4 (0x280c8000)
    libaprutil-1.so.2 => /usr/local/lib/libaprutil-1.so.2 (0x280de000)
    libexpat.so.6 => /usr/local/lib/libexpat.so.6 (0x280f2000)
    libiconv.so.3 => /usr/local/lib/libiconv.so.3 (0x28110000)
    libapr-1.so.2 => /usr/local/lib/libapr-1.so.2 (0x281fd000)
    libcrypt.so.3 => /lib32//libcrypt.so.3 (0x2821d000)
    libpthread.so.2 => not found (0x0)
    libc.so.6 => /lib32//libc.so.6 (0x28235000)
    libpthread.so.2 => /usr/lib32/libpthread.so.2 (0x2830d000)

Added support in ldd(1) for the LD_32_xxx environment variables if
the architecture of the machine is >32 bits. If we ever go to 128
bit architectures this excercise will have to be repeated but thanks
to earlier commits today it will be relative simple.

PR:		bin/124906
Submitted by:	edwin
Approved by:	bde (mentor)
MFC after:	1 week
2008-07-03 22:37:51 +00:00
Edwin Groothuis
d3c1e14b41 Extract the determination of the kind of (dynamic) executable from
the main-loop into a seperate function.
Instead of using hardcoded environment variables, define them in a
lookup table.
For the rest, no functionality changes.

Approved by:	bde (mentor)
MFC after:	1 week
2008-07-03 22:30:18 +00:00
Edwin Groothuis
a0d476a986 stylify ldd.c, no functional changes.
Approved by:	bde (mentor)
MFC after:	1 week
2008-07-03 22:26:43 +00:00
Daniel Gerzo
9ea29562d9 - add the -m option to the example commands because they would fail w/o it
as the ``man'' user does not have a valid shell by default.

PR:		docs/121713
Approved by:	trhodes
MFC after:	3 days
2008-07-01 20:56:23 +00:00
Tim Kientzle
77f719e605 Don't try to hardlink directories. While I'm here, expand some
comments to make this section of code a little clearer.
2008-07-01 05:45:03 +00:00
Xin LI
a9f1ad5de1 Reflect the fact that we actually have NetBSD revision 1.3. 2008-06-30 23:53:15 +00:00