Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions run-command.c
Original file line number Diff line number Diff line change
Expand Up @@ -967,18 +967,24 @@ int start_command(struct child_process *cmd)
return -1;
}

if (need_in)
if (need_in) {
close(fdin[0]);
set_cloexec(fdin[1]);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very good idea. At first, though, I misread this as closing the very file descriptor in the child that the child needs to read from.

I guess it would make for another really good idea to describe a bit better what this patch is all about. In any case, the format of the commit message should also be made to conform to https://git-scm.com/docs/SubmittingPatches#describe-changes. A good example to follow is ccdc481, I would think.

It also misses a Signed-off-by footer, which is required by the Git project (to which we will want to contribute your fix, eventually).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good points, will write up in detail what the issue was with existing code and how this change fixes it. Really appreciate the example.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated commit messages, hope they make things clearer. If you have any feedback though, suggestions are welcome.

else if (cmd->in)
close(cmd->in);

if (need_out)
if (need_out) {
close(fdout[1]);
set_cloexec(fdout[0]);
}
else if (cmd->out)
close(cmd->out);

if (need_err)
if (need_err) {
close(fderr[1]);
set_cloexec(fderr[0]);
}
else if (cmd->err)
close(cmd->err);

Expand Down
3 changes: 1 addition & 2 deletions send-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "sha1-array.h"
#include "gpg-interface.h"
#include "cache.h"
#include "gvfs.h"

int option_parse_push_signed(const struct option *opt,
const char *arg, int unset)
Expand Down Expand Up @@ -51,7 +50,7 @@ static int send_pack_config(const char *var, const char *value, void *unused)

static void feed_object(const struct object_id *oid, FILE *fh, int negative)
{
if (negative && !gvfs_config_is_set(GVFS_MISSING_OK) && !has_sha1_file(oid->hash))
if (negative && !has_sha1_file(oid->hash))
return;

if (negative)
Expand Down