On Fri, Aug 25, 2006 at 06:54:58AM -0400, Robert Connolly wrote:
> In Make-3.81:
>
> --- main.c.orig 2006-08-25 06:50:13.000000000 -0400
> +++ main.c 2006-08-25 06:48:19.000000000 -0400
> @@ -3065,8 +3065,10 @@
> puts core files in the original directory instead of the -C
> directory. Must wait until after remove_intermediates(), or unlinks
> of relative pathnames fail. */
> - if (directory_before_chdir != 0)
> - chdir (directory_before_chdir);
> + if (directory_before_chdir != 0) {
> + int rt = 0;
> + rt = chdir (directory_before_chdir);
> + }
>
> log_working_directory (0);
> }
>
> This removes the warning, and 'make check' passes. I'm not entirely sure if
> this is the right though, maybe someone who knows C can comment.
It's definitely hacky. The warn_unused_result is there for a reason, so
make should do something sensible if chdir fails. The reason that make
doesn't here is that this is in the "die()" function, where we're
exiting anyway.
I'd have thought something like
if (directory_before_chdir != 0)
if (chdir (directory_before_chdir) == -1)
error (NILF, "Failed to return to original directory");
would be a "correct" thing to do. However, I'm building on a non-hlfs
glibc, so my chdir doesn't have the warn_unused_result attr, and so I
can't really check it properly.
Alex :-)
--
Pippin
Computer Monkey to the Pelican
www.oxrev.org.uk, www.corpusjcr.org, www.rev.org.uk
diff -urw make-3.81.old/main.c make-3.81/main.c
--- make-3.81.old/main.c 2006-08-25 12:48:20.000000000 +0100
+++ make-3.81/main.c 2006-08-25 12:50:07.000000000 +0100
@@ -3066,7 +3066,8 @@
directory. Must wait until after remove_intermediates(), or unlinks
of relative pathnames fail. */
if (directory_before_chdir != 0)
- chdir (directory_before_chdir);
+ if (chdir (directory_before_chdir) != -1)
+ error (NILF, "Failed to return to original directory %s",
directory_before_chdir);
log_working_directory (0);
}
pgpDddUaTSM9q.pgp
Description: PGP signature
-- http://linuxfromscratch.org/mailman/listinfo/hlfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page
