Fix the issues in git_shutdown
Fix the issues in git_shutdown

1) Call to git_shutdown results in setting git__n_shutdown_callbacks
to -1. Next call to git__on_shutdown results in ABW (Array Bound Write)
for array git__shutdown_callbacks. In the current Implementation,
git_atomic_dec is called git__n_shutdown_callbacks + 1 times. I have
modified it to a for loop so that it is more readable. It would not
set git__n_shutdown_callbacks to a negative number and reset the
elements of git__shutdown_callbacks to NULL.

2) In function git_sysdir_get, shutdown function is registered only if
git_sysdir__dirs_shutdown_set is set to 0. However, after this variable
is set to 1, it is never reset to 0. If git_sysdir_global_init is
called again from synchronized_threads_init it does not register
shutdown function for this subsystem.

mingyaaaa/libgit2,JIghtuse/libgit2,rcorre/libgit2,sygool/libgit2,leoyanggit/libgit2,jflesch/libgit2-mariadb,sygool/libgit2,Tousiph/Demo1,spraints/libgit2,mhp/libgit2,skabel/manguse,KTXSoftware/libgit2,mhp/libgit2,claudelee/libgit2,JIghtuse/libgit2,Corillian/libgit2,Snazz2001/libgit2,t0xicCode/libgit2,since2014/libgit2,ardumont/libgit2,mrksrm/Mingijura,joshtriplett/libgit2,maxiaoqian/libgit2,nokiddin/libgit2,MrHacky/libgit2,leoyanggit/libgit2,claudelee/libgit2,yosefhackmon/libgit2,sim0629/libgit2,Snazz2001/libgit2,swisspol/DEMO-libgit2,MrHacky/libgit2,jeffhostetler/public_libgit2,JIghtuse/libgit2,KTXSoftware/libgit2,oaastest/libgit2,falqas/libgit2,chiayolin/libgit2,iankronquist/libgit2,stewid/libgit2,stewid/libgit2,mcanthony/libgit2,dleehr/libgit2,Tousiph/Demo1,whoisj/libgit2,KTXSoftware/libgit2,dleehr/libgit2,JIghtuse/libgit2,whoisj/libgit2,saurabhsuniljain/libgit2,saurabhsuniljain/libgit2,rcorre/libgit2,joshtriplett/libgit2,mcanthony/libgit2,falqas/libgit2,rcorre/libgit2,since2014/libgit2,mhp/libgit2,amyvmiwei/libgit2,Corillian/libgit2,falqas/libgit2,dleehr/libgit2,KTXSoftware/libgit2,kissthink/libgit2,Tousiph/Demo1,t0xicCode/libgit2,raybrad/libit2,yosefhackmon/libgit2,mcanthony/libgit2,claudelee/libgit2,linquize/libgit2,joshtriplett/libgit2,leoyanggit/libgit2,magnus98/TEST,falqas/libgit2,MrHacky/libgit2,magnus98/TEST,leoyanggit/libgit2,maxiaoqian/libgit2,jeffhostetler/public_libgit2,chiayolin/libgit2,nokiddin/libgit2,kenprice/libgit2,dleehr/libgit2,ardumont/libgit2,mrksrm/Mingijura,whoisj/libgit2,ardumont/libgit2,dleehr/libgit2,jeffhostetler/public_libgit2,mhp/libgit2,stewid/libgit2,swisspol/DEMO-libgit2,claudelee/libgit2,iankronquist/libgit2,mingyaaaa/libgit2,yongthecoder/libgit2,spraints/libgit2,chiayolin/libgit2,mingyaaaa/libgit2,raybrad/libit2,leoyanggit/libgit2,mcanthony/libgit2,saurabhsuniljain/libgit2,maxiaoqian/libgit2,kenprice/libgit2,chiayolin/libgit2,linquize/libgit2,yongthecoder/libgit2,since2014/libgit2,raybrad/libit2,jeffhostetler/public_libgit2,chiayolin/libgit2,jflesch/libgit2-mariadb,spraints/libgit2,kissthink/libgit2,oaastest/libgit2,sim0629/libgit2,saurabhsuniljain/libgit2,yongthecoder/libgit2,linquize/libgit2,kissthink/libgit2,rcorre/libgit2,stewid/libgit2,sim0629/libgit2,saurabhsuniljain/libgit2,skabel/manguse,Snazz2001/libgit2,leoyanggit/libgit2,spraints/libgit2,kissthink/libgit2,iankronquist/libgit2,raybrad/libit2,raybrad/libit2,yongthecoder/libgit2,whoisj/libgit2,jflesch/libgit2-mariadb,chiayolin/libgit2,mcanthony/libgit2,jeffhostetler/public_libgit2,sygool/libgit2,amyvmiwei/libgit2,t0xicCode/libgit2,mhp/libgit2,claudelee/libgit2,since2014/libgit2,stewid/libgit2,mingyaaaa/libgit2,kenprice/libgit2,yongthecoder/libgit2,mcanthony/libgit2,amyvmiwei/libgit2,Corillian/libgit2,skabel/manguse,iankronquist/libgit2,oaastest/libgit2,JIghtuse/libgit2,JIghtuse/libgit2,kenprice/libgit2,Corillian/libgit2,nokiddin/libgit2,kissthink/libgit2,kissthink/libgit2,KTXSoftware/libgit2,linquize/libgit2,swisspol/DEMO-libgit2,Tousiph/Demo1,amyvmiwei/libgit2,swisspol/DEMO-libgit2,iankronquist/libgit2,joshtriplett/libgit2,linquize/libgit2,jeffhostetler/public_libgit2,rcorre/libgit2,falqas/libgit2,yosefhackmon/libgit2,spraints/libgit2,stewid/libgit2,skabel/manguse,rcorre/libgit2,MrHacky/libgit2,Tousiph/Demo1,yosefhackmon/libgit2,Corillian/libgit2,mrksrm/Mingijura,magnus98/TEST,maxiaoqian/libgit2,yongthecoder/libgit2,t0xicCode/libgit2,Corillian/libgit2,sim0629/libgit2,spraints/libgit2,skabel/manguse,t0xicCode/libgit2,oaastest/libgit2,sygool/libgit2,magnus98/TEST,ardumont/libgit2,jflesch/libgit2-mariadb,kenprice/libgit2,sim0629/libgit2,Snazz2001/libgit2,Snazz2001/libgit2,magnus98/TEST,whoisj/libgit2,maxiaoqian/libgit2,Snazz2001/libgit2,swisspol/DEMO-libgit2,claudelee/libgit2,mingyaaaa/libgit2,dleehr/libgit2,nokiddin/libgit2,falqas/libgit2,mrksrm/Mingijura,joshtriplett/libgit2,ardumont/libgit2,t0xicCode/libgit2,mrksrm/Mingijura,since2014/libgit2,nokiddin/libgit2,KTXSoftware/libgit2,whoisj/libgit2,mhp/libgit2,Tousiph/Demo1,ardumont/libgit2,jflesch/libgit2-mariadb,sygool/libgit2,mrksrm/Mingijura,yosefhackmon/libgit2,linquize/libgit2,kenprice/libgit2,sygool/libgit2,joshtriplett/libgit2,amyvmiwei/libgit2,MrHacky/libgit2,maxiaoqian/libgit2,skabel/manguse,MrHacky/libgit2,since2014/libgit2,saurabhsuniljain/libgit2,amyvmiwei/libgit2,swisspol/DEMO-libgit2,mingyaaaa/libgit2,jflesch/libgit2-mariadb,iankronquist/libgit2,oaastest/libgit2,sim0629/libgit2,magnus98/TEST,nokiddin/libgit2,yosefhackmon/libgit2,oaastest/libgit2