From: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
To: ofono@ofono.org
Subject: Re: [RFC patches 07/13] write_file: make transaction-safe
Date: Tue, 08 Jun 2010 22:38:48 +0000 [thread overview]
Message-ID: <1276036994.2478.63.camel@localhost.localdomain> (raw)
In-Reply-To: <201005280943.47503.denkenz@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1497 bytes --]
On Fri, 2010-05-28 at 07:43 -0700, Denis Kenzior wrote:
> Hi Inaky,
>
> > From: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
> >
> > write_file(), as written wasn't transaction-safe; a crash bewtween a
> > file being open and the buffer being written before a safe close would
> > leave the file with a set of undetermined contents.
> >
> > Modified to the file is written to a temporary file name; once
> > completed, it is renamed to the final name. This way, a crash in the
> > middle doesn't leave half-baked files.
> > + /* Now that the file contents are written, rename to the real
> > + * file name; this way we are uniquely sure that the whole
> > + * thing is there. */
>
> Again, prefer multiline comments to be in a certain format
I'll fix this and resubmit.
> > + unlink(path);
> > + /* conserve @r's value from 'write' */
> > + if (link(tmp_path, path) == -1)
> > + r = -1;
> > +error_write:
> > + unlink(tmp_path);
> > +error_mkstemp_full:
> > +error_create_dirs:
> > + g_free(tmp_path);
> > g_free(path);
> > return r;
> > }
> >
>
> And I get trouble applying your patch:
> Applying: write_file: make transaction-safe
> /home/denkenz/ofono-master/.git/rebase-apply/patch:13: trailing whitespace.
> /*
> /home/denkenz/ofono-master/.git/rebase-apply/patch:22: trailing whitespace.
> */
> /home/denkenz/ofono-master/.git/rebase-apply/patch:75: trailing whitespace.
Ops, my bad. Ditto, I'll fix and resubmit.
next prev parent reply other threads:[~2010-06-08 22:38 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-26 19:49 [RFC patches 00/13] misc cleanups and SMS ID API Inaky Perez-Gonzalez
2010-05-26 19:49 ` [RFC patches 01/13] Update .gitignore to ignore cscope databases and backup files Inaky Perez-Gonzalez
2010-05-28 14:08 ` Marcel Holtmann
2010-05-28 14:17 ` =?unknown-8bit?q?Jo=C3=A3o?= Paulo Rechi Vita
2010-05-28 14:29 ` Marcel Holtmann
2010-06-08 22:13 ` Inaky Perez-Gonzalez
2010-05-26 19:49 ` [RFC patches 02/13] sms_send_message: add a short roadmap Inaky Perez-Gonzalez
2010-05-28 14:11 ` Marcel Holtmann
2010-06-08 22:00 ` Inaky Perez-Gonzalez
2010-05-28 14:34 ` Denis Kenzior
2010-06-08 22:37 ` Inaky Perez-Gonzalez
2010-05-26 19:49 ` [RFC patches 03/13] documentation: add note about referencing standards Inaky Perez-Gonzalez
2010-05-28 14:13 ` Marcel Holtmann
2010-06-08 22:01 ` Inaky Perez-Gonzalez
2010-05-26 19:49 ` [RFC patches 04/13] sms_assembly_add_fragment_backup: clarify how insertion spot is found Inaky Perez-Gonzalez
2010-05-28 14:27 ` Denis Kenzior
2010-06-08 22:10 ` Inaky Perez-Gonzalez
2010-05-26 19:49 ` [RFC patches 05/13] util.h: Add BUILD_BUG_ON() and friends for compile-time assert checking Inaky Perez-Gonzalez
2010-05-28 14:17 ` Marcel Holtmann
2010-06-08 22:03 ` Inaky Perez-Gonzalez
2010-05-26 19:49 ` [RFC patches 06/13] smutil.h: add missing header file dependencies Inaky Perez-Gonzalez
2010-05-28 14:19 ` Marcel Holtmann
2010-06-08 22:04 ` Inaky Perez-Gonzalez
2010-05-28 14:31 ` Denis Kenzior
2010-06-08 22:30 ` Inaky Perez-Gonzalez
2010-05-26 19:49 ` [RFC patches 07/13] write_file: make transaction-safe Inaky Perez-Gonzalez
2010-05-28 14:43 ` Denis Kenzior
2010-06-08 22:38 ` Inaky Perez-Gonzalez [this message]
2010-05-26 19:49 ` [RFC patches 08/13] storage: add __attribute__((format)) to {write, read}_file() for printf-like variable arg verification Inaky Perez-Gonzalez
2010-05-28 14:45 ` Denis Kenzior
2010-06-08 22:43 ` Inaky Perez-Gonzalez
2010-05-26 19:49 ` [RFC patches 09/13] Add function doc headers to ofono_sms_{create, register} Inaky Perez-Gonzalez
2010-05-28 14:47 ` Denis Kenzior
2010-06-08 22:58 ` Inaky Perez-Gonzalez
2010-05-26 19:49 ` [RFC patches 10/13] doc: explain debugging options to -d, add a pointer in -h to manpage Inaky Perez-Gonzalez
2010-05-28 14:21 ` Marcel Holtmann
2010-06-08 22:07 ` Inaky Perez-Gonzalez
2010-06-08 23:13 ` Marcel Holtmann
2010-06-08 23:33 ` Inaky Perez-Gonzalez
2010-05-26 19:49 ` [RFC patches 11/13] automake: fix installation of udev rules in VPATH builds Inaky Perez-Gonzalez
2010-05-28 14:25 ` Marcel Holtmann
2010-05-28 14:50 ` Denis Kenzior
2010-05-26 19:49 ` [RFC patches 12/13] SMS: introduce message ID API Inaky Perez-Gonzalez
2010-05-28 14:27 ` Marcel Holtmann
2010-06-08 22:12 ` Inaky Perez-Gonzalez
2010-06-08 23:14 ` Marcel Holtmann
2010-05-26 19:49 ` [RFC patches 13/13] SMS: implement SHA256-based message IDs [incomplete] Inaky Perez-Gonzalez
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=1276036994.2478.63.camel@localhost.localdomain \
--to=inaky.perez-gonzalez@intel.com \
--cc=ofono@ofono.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox