aboutsummaryrefslogtreecommitdiff
path: root/forth/system
diff options
context:
space:
mode:
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2014-03-03 17:00:20 +0000
committerMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2014-03-03 17:00:20 +0000
commit8de7480020faad4a204d97045d102a55c59da9a2 (patch)
tree1c9e07fc610248bf0abb1a0944f3556e50c919bb /forth/system
parentb0b4186429ca2fffee8145e0b9bdb30e5d264a41 (diff)
downloadopenbios-8de7480020faad4a204d97045d102a55c59da9a2.zip
openbios-8de7480020faad4a204d97045d102a55c59da9a2.tar.gz
openbios-8de7480020faad4a204d97045d102a55c59da9a2.tar.bz2
ciface.fs: alter nextprop to preserve output buffer unless an error occurs
Previously nextprop would always write a 0 length string to the output buffer before calling the underlying property words, with the assumption that this would be the default return value in the case of an error. MorphOS breaks this assumption by specifying buf == prev when calling nextprop which caused the prev value to be overwritten before it could be used, and so nextprop would always return an (error) exit code of -1. Fix nextprop so that the 0 length string is only written into the output buffer when an error exit code of -1 or 0 is returned, as per the IEEE1275 specification. As reported by BALATON Zoltan <balaton@eik.bme.hu>. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@1271 f158a5a8-5612-0410-a976-696ce0be7e32
Diffstat (limited to 'forth/system')
-rw-r--r--forth/system/ciface.fs8
1 files changed, 5 insertions, 3 deletions
diff --git a/forth/system/ciface.fs b/forth/system/ciface.fs
index 5969f4a..727f0a3 100644
--- a/forth/system/ciface.fs
+++ b/forth/system/ciface.fs
@@ -108,12 +108,13 @@ external
dup 0= if 0 else dup cstrlen then
( buf prev prev_len )
- 0 3 pick c!
\ verify that prev exists (overkill...)
dup if
2dup r@ get-package-property if
- r> 2drop 2drop -1 exit
+ r> 2drop drop
+ 0 swap c!
+ -1 exit
else
2drop
then
@@ -126,7 +127,8 @@ external
dup 1+ -rot ci-strcpy drop 1
else
( buf )
- drop 0
+ 0 swap c!
+ 0
then
;