summaryrefslogtreecommitdiff
path: root/t/lib-gpg/keyring.gpg
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2015-03-18 14:55:32 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2015-03-19 13:38:07 -0700
commitee0e38727f1a67ddd3b8b7f6ecea34624b2a8b51 (patch)
tree5e92dca24ac8b8a57659b5a6bc58ad2da8614024 /t/lib-gpg/keyring.gpg
parentMerge branch 'maint-1.9' into maint-2.0 (diff)
downloadtgif-ee0e38727f1a67ddd3b8b7f6ecea34624b2a8b51.tar.xz
clone: initialize atexit cleanup handler earlier
If clone fails, we generally try to clean up any directories we've created. We do this by installing an atexit handler, so that we don't have to manually trigger cleanup. However, since we install this after touching the filesystem, any errors between our initial mkdir() and our atexit() call will result in us leaving a crufty directory around. We can fix this by moving our atexit() call earlier. It's OK to do it before the junk_work_tree variable is set, because remove_junk makes sure the variable is initialized. This means we "activate" the handler by assigning to the junk_work_tree variable, which we now bump down to just after we call mkdir(). We probably do not want to do it before, because a plausible reason for mkdir() to fail is EEXIST (i.e., we are racing with another "git init"), and we would not want to remove their work. OTOH, this is probably not that big a deal; we will allow cloning into an empty directory (and skip the mkdir), which is already racy (i.e., one clone may see the other's empty dir and start writing into it). Still, it does not hurt to err on the side of caution here. Note that writing into junk_work_tree and junk_git_dir after installing the handler is also technically racy, as we call our handler on an async signal. Depending on the platform, we could see a sheared write to the variables. Traditionally we have not worried about this, and indeed we already do this later in the function. If we want to address that, it can come as a separate topic. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/lib-gpg/keyring.gpg')
0 files changed, 0 insertions, 0 deletions