libbsd: Branch 'master' - 3 commits

Guillem Jover guillem at kemper.freedesktop.org
Thu Dec 10 12:08:55 PST 2009


 include/bsd/sys/cdefs.h |    7 ++++---
 man/fgetln.3            |    2 +-
 src/fgetln.c            |    1 +
 3 files changed, 6 insertions(+), 4 deletions(-)

New commits:
commit c17c7e13c3522c6d72ceb4bc207308b8c7452b44
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Thu Dec 10 18:07:25 2009 +0100

    Expand on API guarantee for fgetln
    
    OpenBSD has begun using the API guarantee that *len is not 0 if
    the fgetln(3) return value is not NULL; document this explicitly
    in the manpage and add a comment to the function implementation
    that this doesn’t need to be checked because getdelim/getline have
    similar guarantees.
    
    Signed-off-by: Thorsten Glaser <tg at mirbsd.org>

diff --git a/man/fgetln.3 b/man/fgetln.3
index d483c09..c01d1ef 100644
--- a/man/fgetln.3
+++ b/man/fgetln.3
@@ -54,7 +54,7 @@ character.
 The length of the line, including the final newline,
 is stored in the memory location to which
 .Fa len
-points.
+points and is guaranteed to be greater than 0 upon successful completion.
 (Note, however, that if the line is the last
 in a file that does not end in a newline,
 the returned text will not contain a newline.)
diff --git a/src/fgetln.c b/src/fgetln.c
index 6e3d000..317880d 100644
--- a/src/fgetln.c
+++ b/src/fgetln.c
@@ -39,6 +39,7 @@ fgetln (FILE *stream, size_t *len)
 	ssize_t nread;
 
 	nread = getline(&line, &line_len, stream);
+	/* Note: the getdelim/getline API ensures nread != 0. */
 	if (nread == -1) {
 		*len = 0;
 		return NULL;
commit a5dbef45e77f1de47b11669443ece451e90b85ab
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Thu Dec 10 21:02:30 2009 +0100

    Make RCS macros take arguments
    
    This was breaking code actually using those macros.
    
    Signed-off-by: Thorsten Glaser <tg at mirbsd.org>

diff --git a/include/bsd/sys/cdefs.h b/include/bsd/sys/cdefs.h
index 6afd8d3..a0b7860 100644
--- a/include/bsd/sys/cdefs.h
+++ b/include/bsd/sys/cdefs.h
@@ -79,15 +79,15 @@
 #endif
 
 #ifndef __RCSID_SOURCE
-# define __RCSID_SOURCE
+# define __RCSID_SOURCE(x)
 #endif
 
 #ifndef __SCCSID
-# define __SCCSID
+# define __SCCSID(x)
 #endif
 
 #ifndef __COPYRIGHT
-# define __COPYRIGHT
+# define __COPYRIGHT(x)
 #endif
 
 #endif
commit 27842d7f773557031790f9479a417ba7c2110e96
Author: Thorsten Glaser <tg at mirbsd.org>
Date:   Thu Dec 10 21:00:45 2009 +0100

    Track bug IDs for __unused collision
    
    Signed-off-by: Thorsten Glaser <tg at mirbsd.org>

diff --git a/include/bsd/sys/cdefs.h b/include/bsd/sys/cdefs.h
index d6884ad..6afd8d3 100644
--- a/include/bsd/sys/cdefs.h
+++ b/include/bsd/sys/cdefs.h
@@ -42,6 +42,7 @@
 #endif
 
 /* Linux headers define a struct with a member names __unused.
+ * Debian bugs: #522773 (linux), #522774 (libc).
  * Disable for now. */
 #if 0
 #ifndef __unused


More information about the libbsd mailing list