<div dir="ltr">Hi Maxim,<div><br></div><div>Thanks for the explanation. Regarding a), what about checking and making sure the type of file is actually a socket before removing? Obviously it does not prevent NGINX from deleting sockets created by other processes but it's a much smaller issue compared to deleting arbitrary file.</div><div><br></div><div>Thanks,</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 30, 2016 at 6:57 AM, Maxim Dounin <span dir="ltr"><<a href="mailto:mdounin@mdounin.ru" target="_blank">mdounin@mdounin.ru</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello!<br>
<span class=""><br>
On Tue, Nov 29, 2016 at 01:30:25PM -0800, Shuxin Yang wrote:<br>
<br>
>      Is there any reason not to delete UNIX domain socket before bind?<br>
<br>
</span>To name a few, deleting a socket implies that:<br>
<br>
a) any file can be accidentally deleted due to a typo in the<br>
   listen directive;<br>
<br>
b) attempts to do duplicate listen are not detected and silently<br>
   break service, e.g., if you start duplicate instance of nginx.<br>
<br>
Instead we delete the socket after closing it.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Maxim Dounin<br>
<a href="http://nginx.org/" rel="noreferrer" target="_blank">http://nginx.org/</a><br>
</font></span><div class="HOEnZb"><div class="h5"><br>
______________________________<wbr>_________________<br>
nginx-devel mailing list<br>
<a href="mailto:nginx-devel@nginx.org">nginx-devel@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx-devel" rel="noreferrer" target="_blank">http://mailman.nginx.org/<wbr>mailman/listinfo/nginx-devel</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><p style="font-family:Helvetica;font-size:12px;color:rgb(64,64,64)"><b>Datong Sun</b>  |  Systems Engineer<br><a href="mailto:datong@cloudflare.com" style="color:rgb(47,123,191)" target="_blank">datong@cloudflare.com</a></p><a href="https://www.cloudflare.com/" style="font-family:Times;font-size:medium" target="_blank"><div style="background-image:url("https://www.cloudflare.com/img/signature-cloud.png");width:200px;height:30px;margin-right:20px;margin-top:20px"></div></a><p style="font-family:Helvetica;font-size:12px;color:rgb(64,64,64)">1 888 99 FLARE  |  <a href="https://www.cloudflare.com/" style="color:rgb(47,123,191)" target="_blank">www.cloudflare.com</a></p></div></div>
</div>