Re: [PATCH v8 4/4] cache-tree: Write updated cache-tree after commit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jul 12, 2014 at 11:44 AM, David Turner <dturner@xxxxxxxxxxxxxxxx> wrote:
> @@ -342,6 +342,15 @@ static char *prepare_index(int argc, const char **argv, const char *prefix,
>
>                 discard_cache();
>                 read_cache_from(index_lock.filename);
> +               if (update_main_cache_tree(WRITE_TREE_SILENT) == 0) {
> +                       fd = open(index_lock.filename, O_WRONLY);
> +                       if (fd >= 0)
> +                               if (write_cache(fd, active_cache, active_nr) == 0) {
> +                                       close_lock_file(&index_lock);

If write_cache() returns a negative value, index.lock is probably
corrupted. Should we die() instead of moving on and returning
index_lock.filename to the caller? The caller may move index.lock to
index later on and officially ruin "index".

> +                       }
> +               }
> +               else
> +                       fprintf(stderr, "FAiled to update main cache tree\n");

make the above line something like this for i18n support:

fprintf_ln(stderr, _("Failed to update main cache tree"));

>
>                 commit_style = COMMIT_NORMAL;
>                 return index_lock.filename;
-- 
Duy
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]