X-Spam-Check-By: sourceware.org Date: Fri, 27 Apr 2007 12:58:46 +0300 From: Andrey Simonenko <simon AT comsys DOT ntu-kpi DOT kiev DOT ua> To: cygwin AT cygwin DOT com Subject: chmod() converts local domain socket file to regular file Message-ID: <20070427095846.GA9290@pm513-1.comsys.ntu-kpi.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.15 (2007-04-06) X-Virus-Status: Clean X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: <cygwin.cygwin.com> List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com> List-Archive: <http://sourceware.org/ml/cygwin/> List-Post: <mailto:cygwin AT cygwin DOT com> List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Greetings, Has Cygwin 1.5.24-2 and XP. A program creates local domain socket. If S_IRUSR bit is removed from the socket file, then this file is converted to a regular file. This program shows this problem (check the output of "ls -l sock"): #include <sys/types.h> #include <sys/socket.h> #include <sys/stat.h> #include <sys/un.h> #include <string.h> #include <unistd.h> int main(void) { struct sockaddr_un addr; int sd; sd = socket(PF_LOCAL, SOCK_DGRAM, 0); if (sd < 0) return 1; memset(&addr, 0, sizeof(addr)); addr.sun_family = PF_LOCAL; strncpy(addr.sun_path, "./sock", sizeof(addr.sun_path) - 1); if (bind(sd, (struct sockaddr *)&addr, SUN_LEN(&addr)) < 0) return 1; if (chmod(addr.sun_path, S_IWUSR) < 0) return 1; if (listen(sd, 4) < 0) return 1; if (close(sd) < 0) return 1; return 0; } -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/