Репозитории ALT
S: | 9.4.0.24.75e248-alt1 |
5.1: | 7.6-alt1 |
4.1: | 6.11-alt1 |
4.0: | 5.97-alt6 |
3.0: | 5.3.1-alt0.4 |
Другие репозитории
Upstream: | 8.1pl3 |
Группа :: Система/Основа
Пакет: coreutils
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: coreutils-5.91-alt-mksock.patch
Скачать
Скачать
diff -uprk.orig coreutils-200501082045.orig/man/Makefile.am coreutils-200501082045/man/Makefile.am
--- coreutils-200501082045.orig/man/Makefile.am 2004-11-25 15:43:53 +0300
+++ coreutils-200501082045/man/Makefile.am 2005-01-11 00:55:13 +0300
@@ -5,7 +5,7 @@ dist_man_MANS = \
echo.1 env.1 expand.1 expr.1 factor.1 false.1 fmt.1 fold.1 groups.1 \
head.1 hostid.1 hostname.1 id.1 install.1 join.1 kill.1 \
link.1 ln.1 logname.1 \
- ls.1 md5sum.1 mkdir.1 mkfifo.1 mknod.1 mv.1 nice.1 nl.1 nohup.1 od.1 \
+ ls.1 md5sum.1 mkdir.1 mkfifo.1 mknod.1 mksock.1 mv.1 nice.1 nl.1 nohup.1 od.1 \
paste.1 pathchk.1 pinky.1 pr.1 printenv.1 printf.1 ptx.1 pwd.1 readlink.1 \
rm.1 rmdir.1 seq.1 sha1sum.1 shred.1 sleep.1 sort.1 split.1 stat.1 stty.1 \
su.1 sum.1 sync.1 tac.1 tail.1 tee.1 test.1 touch.1 tr.1 true.1 tsort.1 \
@@ -65,6 +65,7 @@ md5sum.1: $(common_dep) $(srcdir)/md5sum
mkdir.1: $(common_dep) $(srcdir)/mkdir.x ../src/mkdir.c
mkfifo.1: $(common_dep) $(srcdir)/mkfifo.x ../src/mkfifo.c
mknod.1: $(common_dep) $(srcdir)/mknod.x ../src/mknod.c
+mksock.1: $(common_dep) $(srcdir)/mksock.x ../src/mksock.c
mv.1: $(common_dep) $(srcdir)/mv.x ../src/mv.c
nice.1: $(common_dep) $(srcdir)/nice.x ../src/nice.c
nl.1: $(common_dep) $(srcdir)/nl.x ../src/nl.c
diff -uprk.orig coreutils-200501082045.orig/man/mksock.x coreutils-200501082045/man/mksock.x
--- coreutils-200501082045.orig/man/mksock.x 1970-01-01 03:00:00 +0300
+++ coreutils-200501082045/man/mksock.x 2005-01-11 00:55:13 +0300
@@ -0,0 +1,4 @@
+[NAME]
+mksock \- Create unix domain sockets
+[DESCRIPTION]
+.\" Add any additional description here
diff -uprk.orig coreutils-200501082045.orig/README coreutils-200501082045/README
--- coreutils-200501082045.orig/README 2005-01-08 12:00:08 +0300
+++ coreutils-200501082045/README 2005-01-11 00:55:13 +0300
@@ -10,7 +10,7 @@ The programs that can be built with this
[ base64 basename cat chgrp chmod chown chroot cksum comm cp csplit cut date dd
df dir dircolors dirname du echo env expand expr factor false fmt fold
ginstall groups head hostid hostname id join kill link ln logname ls
- md5sum mkdir mkfifo mknod mv nice nl nohup od paste pathchk pinky pr
+ md5sum mkdir mkfifo mknod mksock mv nice nl nohup od paste pathchk pinky pr
printenv printf ptx pwd readlink rm rmdir seq
sha1sum shred sleep sort
split stat stty su sum sync tac tail tee test touch tr true tsort tty
diff -uprk.orig coreutils-200501082045.orig/src/Makefile.am coreutils-200501082045/src/Makefile.am
--- coreutils-200501082045.orig/src/Makefile.am 2004-12-15 02:53:48 +0300
+++ coreutils-200501082045/src/Makefile.am 2005-01-11 00:55:13 +0300
@@ -5,7 +5,7 @@ EXTRA_PROGRAMS = chroot df hostid nice p
bin_SCRIPTS = groups
bin_PROGRAMS = [ chgrp chown chmod cp dd dircolors du \
ginstall link ln dir vdir ls mkdir \
- mkfifo mknod mv nohup readlink rm rmdir shred stat sync touch unlink \
+ mkfifo mknod mksock mv nohup readlink rm rmdir shred stat sync touch unlink \
cat cksum comm csplit cut expand fmt fold head join md5sum \
nl od paste pr ptx sha1sum sort split sum tac tail tr tsort unexpand uniq wc \
basename date dirname echo env expr factor false \
diff -uprk.orig coreutils-200501082045.orig/src/mksock.c coreutils-200501082045/src/mksock.c
--- coreutils-200501082045.orig/src/mksock.c 1970-01-01 03:00:00 +0300
+++ coreutils-200501082045/src/mksock.c 2005-01-11 00:55:13 +0300
@@ -0,0 +1,157 @@
+/* mksock -- create unix domain sockets.
+ Copyright (C) 90, 91, 1995-2002 Free Software Foundation, Inc.
+
+ 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; either version 2, or (at your option)
+ any later version.
+
+ 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.
+
+ 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+/* Dmitry V. Levin <ldv@altlinux.org> */
+
+#include <config.h>
+#include <stdio.h>
+#include <getopt.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+
+#include "system.h"
+#include "error.h"
+#include "modechange.h"
+#include "quote.h"
+
+/* The official name of this program (e.g., no `g' prefix). */
+#define PROGRAM_NAME "mksock"
+
+#define AUTHORS "Dmitry V. Levin"
+
+static struct option const longopts[] =
+{
+ {"mode", required_argument, NULL, 'm'},
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
+ {NULL, 0, NULL, 0}
+};
+
+void
+usage (int status)
+{
+ if (status != EXIT_SUCCESS)
+ fprintf (stderr, _("Try `%s --help' for more information.\n"),
+ program_invocation_short_name);
+ else
+ {
+ printf (_("Usage: %s [OPTION] NAME...\n"), program_invocation_short_name);
+ fputs (_("\
+Create unix domain sockets with the given NAMEs.\n\
+\n\
+ -m, --mode=MODE set permission mode (as in chmod), not a=rw - umask\n\
+"), stdout);
+ fputs (HELP_OPTION_DESCRIPTION, stdout);
+ fputs (VERSION_OPTION_DESCRIPTION, stdout);
+ printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
+ }
+ exit (status);
+}
+
+int
+main (int argc, char **argv)
+{
+ mode_t newmode;
+ const char *specified_mode = 0;
+ int errors = EXIT_SUCCESS;
+ int optc;
+
+ setlocale (LC_ALL, "");
+ bindtextdomain (PACKAGE, LOCALEDIR);
+ textdomain (PACKAGE);
+
+ atexit (close_stdout);
+
+ while ((optc = getopt_long (argc, argv, "m:", longopts, NULL)) != -1)
+ {
+ switch (optc)
+ {
+ case 0:
+ break;
+ case 'm':
+ specified_mode = optarg;
+ break;
+ case_GETOPT_HELP_CHAR;
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+ default:
+ usage (EXIT_FAILURE);
+ }
+ }
+
+ if (optind == argc)
+ {
+ error (EXIT_SUCCESS, 0, _("too few arguments"));
+ usage (EXIT_FAILURE);
+ }
+
+ newmode = (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
+ if (specified_mode)
+ {
+ struct mode_change *change = mode_compile (specified_mode);
+ if (!change)
+ error (EXIT_FAILURE, 0, _("invalid mode"));
+ newmode = mode_adjust (newmode, change, umask (0));
+ free (change);
+ }
+
+ for (; optind < argc; ++optind)
+ {
+ struct sockaddr_un sun;
+ int fd;
+
+ if (strlen (argv[optind]) >= sizeof (sun))
+ {
+ error (EXIT_SUCCESS, EINVAL, _("cannot bind socket `%s'"),
+ quote (argv[optind]));
+ errors = EXIT_FAILURE;
+ continue;
+ }
+
+ memset (&sun, 0, sizeof (sun));
+ sun.sun_family = AF_UNIX;
+ strcpy (sun.sun_path, argv[optind]);
+
+ fd = socket (PF_UNIX, SOCK_STREAM, 0);
+ if (fd < 0)
+ {
+ error (EXIT_SUCCESS, errno, _("cannot create socket `%s'"),
+ quote (argv[optind]));
+ errors = EXIT_FAILURE;
+ continue;
+ }
+
+ if (specified_mode && fchmod (fd, newmode))
+ {
+ error (EXIT_SUCCESS, errno, _("cannot set permissions of socket `%s'"),
+ quote (argv[optind]));
+ close (fd);
+ errors = EXIT_FAILURE;
+ continue;
+ }
+
+ if (bind (fd, (struct sockaddr *) &sun, sizeof (sun)))
+ {
+ error (EXIT_SUCCESS, errno, _("cannot bind socket `%s'"),
+ quote (argv[optind]));
+ errors = EXIT_FAILURE;
+ }
+ close (fd);
+ }
+
+ return errors;
+}
diff -uprk.orig coreutils-200501082045.orig/tests/help-version coreutils-200501082045/tests/help-version
--- coreutils-200501082045.orig/tests/help-version 2005-01-06 01:08:48 +0300
+++ coreutils-200501082045/tests/help-version 2005-01-11 00:55:13 +0300
@@ -103,6 +103,7 @@ chgrp_args=--version
chown_args=--version
mkfifo_args=--version
mknod_args=--version
+mksock_args=--version
# Punt on uptime, since it fails (e.g., failing to get boot time)
# on some systems, and we shouldn't let that stop `make check'.
uptime_args=--version