tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Error building pbulk on Ubuntu-10.04



Hi all,

while getting linker errors during devel/glib2 update, I decided to do
the long planned switch to pbulk.

But while building it, I encountered several errors like that:

> gcc -O2 -Wno-error -Wno-error  -Wall -Wstrict-prototypes
-Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wreturn-type
-Wcast-qual -Wpointer-arith -Wwrite-strings -Wswitch -Wshadow -Werror
-D_GNU_SOURCE -DHAVE_NBCOMPAT_H=1
-I/tmp/pkgsrc/pkgtools/pbulk-base/work/libnbcompat
-I/tmp/pkgsrc/pkgtools/pbulk-base/work/pbulk/pbuild/../lib -c pbuild.c
> cc1: warnings being treated as errors
> pbuild.c: In function 'build_package':
> pbuild.c:217: error: ignoring return value of 'write', declared with >
attribute warn_unused_result
> *** Error code 1

Seems that the gcc (Ubuntu 4.4.3-4ubuntu5.1) 4.4.3 doesn't accept the
actively ignorance of return values which are declared with attribute
warn_unused_result.

Attached patches seems to help - patch and commit? Or are issues on
other OS expected than? (I can't currently test with anything else, I'm
bound to this Ubuntu for some weeks).

/Jens
$NetBSD$

--- lib/event.c.orig    2012-05-08 08:25:11.062594409 +0000
+++ lib/event.c
@@ -270,7 +270,8 @@ signal_handler(int sig_id)
        }
 
        old_errno = errno;
-       write(signal_pipe[1], &buf, 1);
+       if(write(signal_pipe[1], &buf, 1))
+               ;
        errno = old_errno;
 }
 
$NetBSD$

--- lib/exec.c.orig     2012-05-08 08:25:11.062594409 +0000
+++ lib/exec.c
@@ -68,14 +68,18 @@ fork_chdir_exec(const char *dir, const c
 
        (void)close(output_pipe[0]);
        if (chdir(dir) == -1) {
-               (void)write(STDERR_FILENO, chdir_err, sizeof(chdir_err) - 1);
-               (void)write(STDERR_FILENO, dir, strlen(dir));
-               (void)write(STDERR_FILENO, "\".\n", 3);
+               if(write(STDERR_FILENO, chdir_err, sizeof(chdir_err) - 1))
+                       ;
+               if(write(STDERR_FILENO, dir, strlen(dir)))
+                       ;
+               if(write(STDERR_FILENO, "\".\n", 3))
+                       ;
                _exit(1);
        }
        if (output_pipe[1] != STDOUT_FILENO) {
                if (dup2(output_pipe[1], STDOUT_FILENO) == -1) {
-                       (void)write(STDERR_FILENO, dup2_err, sizeof(dup2_err) - 
1);
+                       if(write(STDERR_FILENO, dup2_err, sizeof(dup2_err) - 1))
+                               ;
                        _exit(1);
                }
                (void)close(output_pipe[1]);
$NetBSD$

--- pbuild/pbuild.c.orig        2012-05-08 08:25:11.192590047 +0000
+++ pbuild/pbuild.c
@@ -214,7 +214,8 @@ build_package(const char *build_info, si
        if (dup2(input[0], 0) == -1) {
                const char err_msg[] = "dup failed for stdin\n";
 
-               (void)write(STDERR_FILENO, err_msg, sizeof(err_msg) - 1);
+               if(write(STDERR_FILENO, err_msg, sizeof(err_msg) - 1))
+                       ;
                _exit(255);
        }
 


Home | Main Index | Thread Index | Old Index