Skip to content

Commit

Permalink
syntax-check: Add a rule to enforce glnx_autofd over glnx_fd_close
Browse files Browse the repository at this point in the history
And fix the one final use.

Closes: ostreedev#1280
Approved by: jlebon
  • Loading branch information
cgwalters authored and rh-atomic-bot committed Oct 17, 2017
1 parent 3577b4a commit 9955695
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion cfg.mk
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ sc_glnx_errno_prefix_colon:
@prohibit='\<glnx_throw_errno_prefix *\(.*: ",' halt="don't add trailing : for glnx_throw_errno_prefix" \
$(_sc_search_regexp)

sc_glnx_no_fd_close:
@prohibit='\<glnx_fd_close int' halt="Use glnx_autofd, not glnx_fd_close" \
$(_sc_search_regexp)

#SHELL=bash -x
show-vc-list-except:
@$(VC_LIST_EXCEPT)

VC_LIST_ALWAYS_EXCLUDE_REGEX = ^ABOUT-NLS|maint.mk|*.gpg|*.sig|.xz$$
VC_LIST_ALWAYS_EXCLUDE_REGEX = ^ABOUT-NLS|cfg.mk|maint.mk|*.gpg|*.sig|.xz$$
2 changes: 1 addition & 1 deletion src/libostree/ostree-repo-commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ adopt_and_commit_regfile (OstreeRepo *self,
ot_checksum_init (&hasher);
ot_checksum_update_bytes (&hasher, header);

glnx_fd_close int fd = -1;
glnx_autofd int fd = -1;
if (!glnx_openat_rdonly (dfd, name, FALSE, &fd, error))
return FALSE;

Expand Down

0 comments on commit 9955695

Please sign in to comment.