Michael Haggerty [off-list ref] writes:
+static int open_staging_file(struct lock_file *lk)
+{
+ strbuf_setlen(&lk->staging_filename, lk->filename.len);
+ strbuf_addstr(&lk->staging_filename, ".new");
+ lk->fd = open(lk->staging_filename.buf, O_RDWR | O_CREAT | O_EXCL, 0666);
+ if (lk->fd < 0) {
+ return -1;
+ }
All the other "if (lk->fd < 0)" calls reset_lock_file(lk). Is it an
intentional omission that this one does not?
If so, please drop the extraneous {} around the single "return -1"
statement.
I also share the same puzzlement in Peff's review.