X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Funixsock.c;h=e62ed6c0596b5ddb29848e66805d6e5ffd036f1c;hb=59547eb66a3743ca0b458222d7a4318f3e659a60;hp=7e7a1b1a857eb73c4529dd038d011f3b19cf1ed7;hpb=68ac98ed21d932fc80dd2d296543564b7a06dac2;p=collectd.git diff --git a/src/unixsock.c b/src/unixsock.c index 7e7a1b1a..e62ed6c0 100644 --- a/src/unixsock.c +++ b/src/unixsock.c @@ -2,21 +2,26 @@ * collectd - src/unixsock.c * Copyright (C) 2007,2008 Florian octo Forster * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; only version 2 of the License is applicable. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. * - * Author: - * Florian octo Forster + * Authors: + * Florian octo Forster **/ #include "collectd.h" @@ -123,7 +128,16 @@ static int us_open_socket (void) return (-1); } - chmod (sa.sun_path, sock_perms); + status = chmod (sa.sun_path, sock_perms); + if (status == -1) + { + char errbuf[1024]; + ERROR ("unixsock plugin: chmod failed: %s", + sstrerror (errno, errbuf, sizeof (errbuf))); + close (sock_fd); + sock_fd = -1; + return (-1); + } status = listen (sock_fd, 8); if (status != 0)