lib/commit: Fix EBADF with GENERATE_SIZES option for commit

Regression from previous tmpfile refactoring; unfortunately
the `OSTREE_REPO_COMMIT_MODIFIER_FLAGS_GENERATE_SIZES` option
only has coverage via gjs currently.

Might expose it via the cmdline in a later option, but in the big picture the
idea was that this data is better kept in static deltas.

Closes: https://github.com/ostreedev/ostree/issues/1014

Closes: #1016
Approved by: jlebon
This commit is contained in:
Colin Walters 2017-07-19 09:19:16 -04:00 committed by Atomic Bot
parent ebbd0b3ce6
commit f9f7d55e79
1 changed files with 11 additions and 11 deletions

View File

@ -734,6 +734,17 @@ write_content_object (OstreeRepo *self,
} }
else else
{ {
/* Update size metadata if configured */
if (indexable && object_file_type == G_FILE_TYPE_REGULAR)
{
struct stat stbuf;
if (!glnx_fstat (tmpf.fd, &stbuf, error))
return FALSE;
repo_store_size_entry (self, actual_checksum, unpacked_size, stbuf.st_size);
}
/* This path is for regular files */ /* This path is for regular files */
if (!commit_loose_regfile_object (self, actual_checksum, &tmpf, if (!commit_loose_regfile_object (self, actual_checksum, &tmpf,
uid, gid, mode, uid, gid, mode,
@ -743,17 +754,6 @@ write_content_object (OstreeRepo *self,
ostree_object_type_to_string (OSTREE_OBJECT_TYPE_FILE)); ostree_object_type_to_string (OSTREE_OBJECT_TYPE_FILE));
} }
/* Update size metadata if configured */
if (indexable && object_file_type == G_FILE_TYPE_REGULAR)
{
struct stat stbuf;
if (!glnx_fstat (tmpf.fd, &stbuf, error))
return FALSE;
repo_store_size_entry (self, actual_checksum, unpacked_size, stbuf.st_size);
}
/* Update statistics */ /* Update statistics */
g_mutex_lock (&self->txn_stats_lock); g_mutex_lock (&self->txn_stats_lock);
self->txn_stats.content_objects_written++; self->txn_stats.content_objects_written++;