All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Buesch <fsdeveloper@yahoo.de>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: linux kernel mailing list <linux-kernel@vger.kernel.org>,
	Roman Zippel <zippel@linux-m68k.org>
Subject: [PATCH] fix menuconfig if saving on different fs
Date: Mon, 26 May 2003 21:35:14 +0200	[thread overview]
Message-ID: <200305262135.25363.fsdeveloper@yahoo.de> (raw)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi.

This patch fixes the behaviour of make menuconfig, if the
file in the "Save Configuration to Alternate File" menu is
on a different file-system, than the source tree.
Without this patch saving the config to /boot/xyz fails, if
boot is on an own filesystem.

patch against 2.5.69-bk19

Linus, please apply.

- -- 
Regards Michael Büsch
http://www.8ung.at/tuxsoft
 21:27:43 up  5:37,  4 users,  load average: 2.04, 1.35, 1.14



diff -urN -X /home/mb/dontdiff linux-2.5.69-bk19.vanilla/scripts/kconfig/confdata.c linux-2.5.69-bk19/scripts/kconfig/confdata.c
- --- linux-2.5.69-bk19.vanilla/scripts/kconfig/confdata.c	2003-05-26 20:24:44.000000000 +0200
+++ linux-2.5.69-bk19/scripts/kconfig/confdata.c	2003-05-26 21:23:47.000000000 +0200
@@ -1,6 +1,9 @@
 /*
  * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
  * Released under the terms of the GNU GPL v2.0.
+ *
+ * May 26, 2003 Michael Buesch <fsdeveloper@yahoo.de>:
+ *	fixed behaviour of conf_write() if "name" is on different file system.
  */
 
 #include <sys/stat.h>
@@ -239,7 +242,7 @@
 
 int conf_write(const char *name)
 {
- -	FILE *out, *out_h;
+	FILE *out, *out_h, *out_new;
 	struct symbol *sym;
 	struct menu *menu;
 	char oldname[128];
@@ -369,8 +372,30 @@
 
 	sprintf(oldname, "%s.old", name);
 	rename(name, oldname);
- -	if (rename(".tmpconfig", name))
- -		return 1;
+
+	if (rename(".tmpconfig", name)) {
+		if (errno == EXDEV) {
+			out = fopen(".tmpconfig", "r");
+			if (!out)
+				return 1;
+			out_new = fopen(name, "w");
+			if (!out_new) {
+				fclose(out);
+				return 1;
+			}
+			while ((l = fgetc(out)) != EOF) {
+				if (fputc(l, out_new) == EOF) {
+					fclose(out);
+					fclose(out_new);
+					return 1;
+				}
+			}
+			fclose(out);
+			fclose(out_new);
+			unlink(".tmpconfig");
+		} else
+			return 1;
+	}
 
 	sym_change_count = 0;
 


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+0mx9oxoigfggmSgRAsKRAKCHoEFbU386aVjO65KIpBVkMLtF4ACcDj+s
rng5t4l/ClMytEjyal72uXs=
=ciX7
-----END PGP SIGNATURE-----


             reply	other threads:[~2003-05-26 19:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-26 19:35 Michael Buesch [this message]
2003-05-28 16:41 ` [PATCH] fix menuconfig if saving on different fs Roman Zippel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200305262135.25363.fsdeveloper@yahoo.de \
    --to=fsdeveloper@yahoo.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    --cc=zippel@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.