git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Michael Haggerty <mhagger@alum.mit.edu>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jonathan Nieder <jrnieder@gmail.com>,
	git@vger.kernel.org, Michael Haggerty <mhagger@alum.mit.edu>
Subject: [PATCH 2/5] fdopen_lock_file(): use fdopen_with_retry()
Date: Thu,  5 Mar 2015 17:07:46 +0100	[thread overview]
Message-ID: <1425571669-22800-3-git-send-email-mhagger@alum.mit.edu> (raw)
In-Reply-To: <1425571669-22800-1-git-send-email-mhagger@alum.mit.edu>

Suggested-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
Jonathan's original suggestion was that this function should call
xfdopen(). But a couple of callers of fdopen_lock_file() try to
recover if it fails, so I decided to do it this way instead.

 lockfile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lockfile.c b/lockfile.c
index 9889277..cad567b 100644
--- a/lockfile.c
+++ b/lockfile.c
@@ -232,7 +232,7 @@ FILE *fdopen_lock_file(struct lock_file *lk, const char *mode)
 	if (lk->fp)
 		die("BUG: fdopen_lock_file() called twice for file '%s'", lk->filename.buf);
 
-	lk->fp = fdopen(lk->fd, mode);
+	lk->fp = fdopen_with_retry(lk->fd, mode);
 	return lk->fp;
 }
 
-- 
2.1.4

  parent reply	other threads:[~2015-03-05 16:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-05 16:07 [PATCH 0/5] Retry if fdopen() fails due to ENOMEM Michael Haggerty
2015-03-05 16:07 ` [PATCH 1/5] xfdopen(): if first attempt fails, free memory and try again Michael Haggerty
2015-03-05 16:59   ` Stefan Beller
2015-03-05 19:06   ` Junio C Hamano
2015-03-05 16:07 ` Michael Haggerty [this message]
2015-03-05 16:07 ` [PATCH 3/5] copy_to_log(): use fdopen_with_retry() Michael Haggerty
2015-03-05 16:07 ` [PATCH 4/5] update_info_file(): " Michael Haggerty
2015-03-05 16:07 ` [PATCH 5/5] buffer_fdinit(): " Michael Haggerty
2015-03-05 19:19 ` [PATCH 0/5] Retry if fdopen() fails due to ENOMEM Junio C Hamano
2015-03-10 11:42   ` Michael Haggerty
2015-03-06  5:08 ` Torsten Bögershausen
2015-03-10 11:44   ` Michael Haggerty
2015-03-17 22:32     ` Junio C Hamano

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=1425571669-22800-3-git-send-email-mhagger@alum.mit.edu \
    --to=mhagger@alum.mit.edu \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).