Commit Graph

8289 Commits

Author SHA1 Message Date
tron
410614d6b3 Replace _FPOS_OVERFLOW() macro with a static inline function called
__fpos_overflow() that doesn't cause any lint warnings.
2010-10-24 17:44:32 +00:00
christos
3dbfe3dd7e tell lint to shut up. 2010-10-23 14:12:50 +00:00
christos
13fa4dc134 not that it can happen, but make the test more robust. 2010-10-22 22:00:32 +00:00
christos
ec053f73a0 implement EOVERFLOW 2010-10-22 21:29:45 +00:00
christos
603e33ef32 Fix return value documentation. Add EOVERFLOW for ftell, but not for fseek. 2010-10-22 21:29:31 +00:00
njoly
4c968434a3 Make setenv(3) follow the standard, by rejecting invalid strings. It
now fails with EINVAL errno when variable is NULL, empty or contains
an `=' character; or value is NULL.

Adjust the man page accordingly, and exercize them in the existing
environment testcase.
2010-10-16 11:23:41 +00:00
skrll
e6cdac9c4b Implement dl_iterate_phdr.
Somewhat taken from FreeBSD. Manual page from OpenBSD.
2010-10-16 10:27:06 +00:00
enami
3cef3e6eba The was is not an argument but simply a part of sentense. 2010-10-07 00:14:14 +00:00
enami
4a94dc0b8f Avoid unnecessary malloc(). Since __findenv() kindly treats
equal sign as an end of string, we can pass the string of
form "key=value" to lookup "key".
2010-10-05 02:23:38 +00:00
tron
ae557324e5 Restore binary compatibility with applications which use putenv(3)
on constant strings (e.g. postdrop(1)):
- Don't write to the environment string passed to putenv(3).
- Don't overwrite the value of an existing environment string
  unless the memory was actually allocated by setenv(3).
2010-10-02 16:56:03 +00:00
tron
c3bcf19cf7 Make sure that all extra elements of the environment vector are set
to NULL. This stop su(1) from crashing.
2010-10-02 10:51:07 +00:00
tron
12c10b36d2 Remember that we didn't malloc() memory for an environment variable
if it has been set via putenv(3).
2010-10-02 10:05:55 +00:00
wiz
732dd678dd Fix a typo, remove trailing whitespace. 2010-10-01 20:57:50 +00:00
christos
7acc3301d8 make putenv POSIX compliant. 2010-10-01 20:11:32 +00:00
tron
2445ce72d2 Be slightly more careful about freeing memory allocated for environment
variables: only free memory if the current value points to the same
memory area as the allocated block. This will prevent crashes if an
application changes the order of the environment array.

Unfortunately this is still not enough to stop zsh 4.2.* from crashing.
zsh 4.3.* works fine before and after this change.
2010-09-30 12:41:33 +00:00
enami
be59ef257e If new length is exactly equals to the current length,
there is nothing to do.
2010-09-29 00:44:04 +00:00
enami
248290ef3a Don't put space before close paren. 2010-09-29 00:40:17 +00:00
enami
abfd061908 Add missing period at the end of sentense. 2010-09-28 00:39:56 +00:00
tnozaki
9ef74dfbcf validate flags/oflags from __sflag() befere call __sfp().
reviewed by enami-san, thanks.
2010-09-27 17:08:29 +00:00
tnozaki
6d102a3218 fix off-by-one, pointed out by enami-san, thanks! 2010-09-27 16:50:13 +00:00
yamt
ab5972b02c fix rewinddir on nfs. fix PR/42879 (and probably PR/40229.) 2010-09-26 02:26:59 +00:00
christos
0588f13b3b be more conservative about allocing. 2010-09-25 19:31:51 +00:00
tron
ed5e497e60 Remember the correct pointer which we will free later. 2010-09-25 19:10:37 +00:00
tron
1f5de17d4a Unlock the environment lock if __alocenv() fails. 2010-09-25 18:37:24 +00:00
tron
5cdca2e600 Remember memory used by allocated environment variables instead of
using a bitmap. This deals with the case where a variable is first
set via setenv(3) or putenv(3), then overwritten by changing
"environ" directory and afterwards overwritten with setenv(3) again.

This stops "zsh" from crashing under NetBSD-current.

Code reviewed by Christos Zoulas.
2010-09-25 18:11:40 +00:00
tron
ac440cccfd Change last commit to Use "ptrdiff_t" instead of "intptr_t" because the
former is more appropriate in this case.
2010-09-25 14:00:30 +00:00
tron
abf0c843b2 Add explicit cast to fix lint error on 32bit platforms. 2010-09-25 13:45:11 +00:00
wiz
14087bca56 Remove trailing whitespace, merge error sections for same error, nits. 2010-09-25 09:44:08 +00:00
uwe
46b35128cb Make groff happy. 2010-09-25 01:19:39 +00:00
christos
97fddff649 add man page as promised. 2010-09-24 21:50:56 +00:00
matt
3edad85883 If not using O32 on mips, we need to read ELF64 symbols too. 2010-09-24 15:57:15 +00:00
christos
da3a4052e4 protect the __allocenv call with the mutex; from Enami 2010-09-24 14:34:44 +00:00
christos
f6033a77ae Fix memory leaks; thanks Enami! 2010-09-24 14:31:15 +00:00
tnozaki
93b7363c93 add fmemopen(3) derrived from POSIX:2008.
libc minor bump.
2010-09-24 09:21:53 +00:00
christos
7db74b9a82 Use a bit array to keep track of malloced environment entries so we can
free them.
2010-09-23 17:30:49 +00:00
christos
e957123b85 PR/43899: Nicolas Joly: setenv(3)/unsetenv(3) memory leak.
Partial fix: Don't allocate a new string if the length is equal to the
old length, because presumably the old string was also nul terminated
so it has the extra byte needed.
The real fix is to keep an adjunct array of bits, one for each environment
variable and keep track if the entry was allocated or not so that we can
free it in unsetenv.
2010-09-23 16:02:41 +00:00
njoly
abdcf63ade Add empty line in ERRORS section. 2010-09-23 12:49:31 +00:00
wiz
98890d79a7 Bump date for O_DIRECTORY, more markup, merge two error sections. 2010-09-22 17:58:09 +00:00
chs
38b9dc3505 implement O_DIRECTORY as standardized in POSIX-2008,
for both native and linux emulations.
this fixes the rest of PR 43695.
2010-09-21 19:26:18 +00:00
yamt
53cf9ce3be - remove a wrong _DIAGASSERT
- update comments
- whitespace
2010-09-16 02:38:50 +00:00
matt
8e09c95f97 Resurrect this for MIPS softfloat. 2010-09-10 16:32:35 +00:00
drochner
927f8fc1e3 apply an 11 years old fix from FreeBSD:
if EBADF is returned due to a read from a write-only stream, also
set ferror()
found by a selftest of Python-2.6.6, thanks to obache for pointing
out the details
2010-09-10 10:29:23 +00:00
skrll
2a4732aadc Only do the __libc_init hack in libc, i.e. remove it from ld.elf_so.
This fixes hppa ld.elf_so by reducing the number of PLABELs required to
the number before the hack was applied.

Hi Joerg!
2010-09-09 10:19:31 +00:00
wiz
f1ecb8cf31 O_NOFOLLOW is not a non-standard extension any longer (2, 6 years? who counts). 2010-09-06 19:48:38 +00:00
wiz
c70635ec83 I assume "POSIX 200805" is IEEE Std 1003.1-2008 (POSIX.1), so use
appropriate .St.
2010-09-06 19:47:37 +00:00
jakllsch
a34ac1b5ed New vdprintf needs "namespace protection". 2010-09-06 17:49:56 +00:00
wiz
4dd873e1cd Note a difference to IEEE Std 2003.1-2008. Bump date. 2010-09-06 15:22:09 +00:00
christos
4ddc2fb37c add dprintf and vdprintf 2010-09-06 14:52:55 +00:00
christos
7d79ab9567 Add GLOB_STAR support from Greg Dionne. 2010-09-06 14:40:24 +00:00
wiz
d9898a950b Explain how O_NOFOLLOW may cause EFTYPE. From joerg.
While here, sort errors. Bump date.
2010-09-05 22:44:15 +00:00