commit-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[hurd] 01/01: New upstream snapshot


From: Samuel Thibault
Subject: [hurd] 01/01: New upstream snapshot
Date: Sat, 02 Nov 2013 14:44:47 +0000

This is an automated email from the git hooks/post-receive script.

sthibault pushed a commit to branch upstream-merged
in repository hurd.

commit 95bd1b91857f6e578c05239b45ce9c87b64af796
Author: Samuel Thibault <address@hidden>
Date:   Fri Nov 1 22:38:52 2013 +0000

    New upstream snapshot
---
 configure.ac                |    2 +-
 console-client/console.c    |   11 +++--
 console-client/input.h      |    2 +-
 console/display.c           |    5 ++-
 console/hurd.ti             |    6 +--
 daemons/rc.sh               |    9 +++-
 exec/Makefile               |    3 --
 exec/hashexec.c             |    1 +
 exec/hostarch.c             |   99 +------------------------------------------
 exec/main.c                 |   19 ---------
 libdiskfs/file-set-size.c   |    2 +-
 libdiskfs/ifsock.c          |    2 +-
 libdiskfs/node-nput.c       |    6 +++
 libfshelp/translator-list.c |    5 ++-
 libnetfs/dir-lookup.c       |    4 +-
 libnetfs/file-set-size.c    |    2 +
 libports/create-internal.c  |    9 ++--
 libshouldbeinlibc/maptime.c |    2 +
 libtreefs/s-file.c          |    2 +
 libtrivfs/protid-clean.c    |   13 +++---
 pflocal/sock.c              |    6 ++-
 pflocal/socket.c            |    5 +--
 procfs/rootdir.c            |   55 ++++++++++++++++++------
 storeio/io.c                |    2 +
 term/ptyio.c                |    6 +++
 term/users.c                |    2 +
 tmpfs/tmpfs.c               |    6 ---
 trans/mtab.c                |   16 +++----
 trans/null.c                |    2 +
 trans/streamio.c            |    2 +
 30 files changed, 126 insertions(+), 180 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6844f6c..d822dd2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -259,7 +259,7 @@ PKG_CHECK_MODULES([X11], [x11 xproto],
     have_keysymdef_h=no
     AC_CHECK_HEADER([X11/keysymdef.h],
       [AC_MSG_CHECKING([for X11/keysymdef.h absolute location])
-       AC_PREPROC_IFELSE([#include <X11/keysymdef.h>],
+       AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <X11/keysymdef.h>]])],
          [[X11_KEYSYMDEF_H=`$SED -n 
's%^[^"]*"\([^"]*X11/keysymdef.h\)".*$%\1%p' conftest.i`]
           # did the sed magic above work?
           AS_IF([test -f "$X11_KEYSYMDEF_H"],
diff --git a/console-client/console.c b/console-client/console.c
index f995ca2..2fb2fbe 100644
--- a/console-client/console.c
+++ b/console-client/console.c
@@ -181,6 +181,7 @@ console_move_mouse (mouse_event_t ev)
     {
       err = cons_vcons_move_mouse (vcons, ev);
       ports_port_deref (vcons);
+      return err;
     }
 
   return 0;
@@ -275,6 +276,10 @@ void
 console_exit (void)
 {
   driver_fini ();
+#if HAVE_DAEMON
+  if (daemonize)
+    daemon_pid_file_remove ();
+#endif /* HAVE_DAEMON */
   exit (0);
 }
 
@@ -626,6 +631,7 @@ static struct argp startup_argp = {options, parse_opt, 0,
            {                                                           \
              /* Signal parent.  */                                     \
              daemon_retval_send (status);                              \
+             daemon_pid_file_remove ();                                \
              return 0;                                                 \
            }                                                           \
        }                                                               \
@@ -734,12 +740,11 @@ main (int argc, char *argv[])
 #if HAVE_DAEMON
   if (daemonize)
     /* Signal parent that all went well.  */
-    daemon_retval_send(0);
+    daemon_retval_send (0);
 #endif
 
   cons_server_loop ();
 
   /* Never reached.  */
-  driver_fini ();
-  return 0;
+  console_exit ();
 }
diff --git a/console-client/input.h b/console-client/input.h
index 351fa34..61deadc 100644
--- a/console-client/input.h
+++ b/console-client/input.h
@@ -66,7 +66,7 @@ error_t console_switch (int id, int delta);
 void console_error (const wchar_t *const err_msg);
 
 /* Exit the console client.  Does not return.  */
-void console_exit (void);
+void console_exit (void) __attribute__ ((noreturn));
 
 /* Switch away from the console an external use of the console like
    XFree.  */
diff --git a/console/display.c b/console/display.c
index 97e1626..8d9e478 100644
--- a/console/display.c
+++ b/console/display.c
@@ -1186,8 +1186,9 @@ handle_esc_bracket (display_t display, char op)
     case 'B':          /* ECMA-48 <CUD>.  */
     case 'e':          /* ECMA-48 <VPR>.  */
       /* Cursor down: <cud1>, <cud>.  */
-      user->cursor.row += (parse->params[0] ?: 1);
-      limit_cursor (display);
+      /* Most implementations scroll the screen.  */
+      for (i = 0; i < (parse->params[0] ?: 1); i++)
+       linefeed (display);
       break;
     case 'C':          /* ECMA-48 <CUF>.  */
       /* Cursor right: <cuf1>, <cuf>.  */
diff --git a/console/hurd.ti b/console/hurd.ti
index 2508482..f5c8650 100644
--- a/console/hurd.ti
+++ b/console/hurd.ti
@@ -7,10 +7,6 @@ hurd|The GNU Hurd console server,
 # Hard reset.
        rs1=\EM,
 
-# Note about compatibility to vt100: We don't specify <xenl>, as we
-# don't have the eat_newline_glitch.  We don't support setting or
-# removing tab stops (hts/tbc).
-
 # Cursor related capabilities.
 
 # Moving the cursor.
@@ -18,6 +14,8 @@ hurd|The GNU Hurd console server,
        am,
 # We wrap around the left edge.
        bw,
+# We ignore \n at end of line
+       xenl,
 # Carriage return and newline.
        cr=^M, nel=^M^J,
 # Move cursor to home position (to position P1, P2).
diff --git a/daemons/rc.sh b/daemons/rc.sh
index 5778094..5cf44fa 100644
--- a/daemons/rc.sh
+++ b/daemons/rc.sh
@@ -26,10 +26,15 @@ then
        0)
                ;;
        # Filesystem modified (but ok now)
-       1 | 2)
+       1)
+               ;;
+       # Filesystem modified, filesystem should be restarted
+       # Ideally we would only restart the filesystem
+       2 | 3)
+               /sbin/reboot
                ;;
        # Fsck couldn't fix it.
-       4 | 8)
+       4 | 5 | 8 | 9)
                echo "Automatic boot failed... help!"
                exit 1
                ;;
diff --git a/exec/Makefile b/exec/Makefile
index 890ee4b..3ef742d 100644
--- a/exec/Makefile
+++ b/exec/Makefile
@@ -26,7 +26,6 @@ OBJS = main.o hostarch.o exec.o hashexec.o \
 
 target = exec
 #targets = exec exec.static
-#OTHERLIBS = -lbfd -liberty
 HURDLIBS = trivfs fshelp iohelp ports ihash shouldbeinlibc
 OTHERLIBS = -lpthread
 
@@ -34,6 +33,4 @@ exec-MIGSFLAGS = -imacros $(srcdir)/execmutations.h
 
 include ../Makeconf
 
-CPPFLAGS += # -DBFD
-
 exec.static exec: $(OBJS) $(library_deps)
diff --git a/exec/hashexec.c b/exec/hashexec.c
index e20a462..5641218 100644
--- a/exec/hashexec.c
+++ b/exec/hashexec.c
@@ -426,6 +426,7 @@ check_hashbang (struct execdata *e,
                        deallocnames, ndeallocnames,
                        destroynames, ndestroynames);
   mach_port_deallocate (mach_task_self (), interp_file);
+  munmap (new_argv, new_argvlen);
 
   if (! e->error)
     {
diff --git a/exec/hostarch.c b/exec/hostarch.c
index b37adb9..a3b9330 100644
--- a/exec/hostarch.c
+++ b/exec/hostarch.c
@@ -1,4 +1,4 @@
-/* Determine the BFD and ELF architecture and machine flavor
+/* Determine the ELF architecture and machine flavor
    from a Mach host port.  Used by the exec and core servers.
    Copyright (C) 1992,93,95,96,99,2000,02 Free Software Foundation, Inc.
    Written by Roland McGrath.
@@ -87,100 +87,3 @@ elf_machine_matches_host (ElfW(Half) e_machine)
 
   return 0;
 }
-
-#ifdef BFD
-#include <bfd.h>
-
-error_t
-bfd_mach_host_arch_mach (host_t host,
-                        enum bfd_architecture *arch,
-                        long int *machine)
-{
-  error_t err;
-  struct host_basic_info hostinfo;
-  mach_msg_type_number_t hostinfocnt = HOST_BASIC_INFO_COUNT;
-
-  err = host_info (host, HOST_BASIC_INFO, (natural_t *) &hostinfo, 
&hostinfocnt);
-  if (err)
-    return err;
-
-  *machine = hostinfo.cpu_subtype;
-  *e_machine = EM_NONE;
-  switch (hostinfo.cpu_type)
-    {
-    case CPU_TYPE_MC68020:
-      *arch = bfd_arch_m68k;
-      *machine = 68020;
-      *e_machine = EM_68K;
-      break;
-    case CPU_TYPE_MC68030:
-      *arch = bfd_arch_m68k;
-      *machine = 68030;
-      *e_machine = EM_68K;
-      break;
-    case CPU_TYPE_MC68040:
-      *arch = bfd_arch_m68k;
-      *machine = 68040;
-      *e_machine = EM_68K;
-      break;
-
-    case CPU_TYPE_NS32032:
-      *arch = bfd_arch_ns32k;
-      *machine = 32032;
-      break;
-    case CPU_TYPE_NS32332:
-      *arch = bfd_arch_ns32k;
-      *machine = 32332;
-      break;
-    case CPU_TYPE_NS32532:
-      *arch = bfd_arch_ns32k;
-      *machine = 32532;
-      break;
-
-    case CPU_TYPE_ROMP:
-      *arch = bfd_arch_romp;
-      break;
-
-    case CPU_TYPE_I860:
-      *arch = bfd_arch_i860;
-      *e_machine = EM_860;
-      break;
-
-    case CPU_TYPE_MIPS:
-      *arch = bfd_arch_mips;
-      *e_machine = EM_MIPS;
-      break;
-
-    case CPU_TYPE_VAX:
-      *arch = bfd_arch_vax;
-      break;
-
-    case CPU_TYPE_MC88000:
-      *arch = bfd_arch_m88k;
-      *e_machine = EM_88K;
-      break;
-
-    case CPU_TYPE_SPARC:
-      *arch = bfd_arch_sparc;
-      *e_machine = EM_SPARC;
-      break;
-
-    case CPU_TYPE_I386:
-      *arch = bfd_arch_i386;
-      *e_machine = EM_386;
-      break;
-
-#ifdef CPU_TYPE_ALPHA
-    case CPU_TYPE_ALPHA:
-      *arch = bfd_arch_alpha;
-      break;
-#endif
-
-    default:
-      return ENOEXEC;
-    }
-
-  return 0;
-}
-
-#endif /* BFD */
diff --git a/exec/main.c b/exec/main.c
index d5d6882..d23cc12 100644
--- a/exec/main.c
+++ b/exec/main.c
@@ -29,15 +29,6 @@
 
 const char *argp_program_version = STANDARD_HURD_VERSION (exec);
 
-#ifdef BFD
-bfd_arch_info_type host_bfd_arch_info;
-bfd host_bfd = { arch_info: &host_bfd_arch_info };
-extern error_t bfd_mach_host_arch_mach (host_t host,
-                                       enum bfd_architecture *bfd_arch,
-                                       long int *bfd_machine,
-                                       ElfW(Half) *elf_machine);
-#endif
-
 /* Trivfs hooks.  */
 int trivfs_fstype = FSTYPE_MISC;
 int trivfs_fsid = 0;
@@ -115,16 +106,6 @@ main (int argc, char **argv)
 
   save_argv = argv;
 
-#ifdef BFD
-  /* Put the Mach kernel's idea of what flavor of machine this is into the
-     fake BFD against which architecture compatibility checks are made.  */
-  err = bfd_mach_host_arch_mach (mach_host_self (),
-                                &host_bfd.arch_info->arch,
-                                &host_bfd.arch_info->mach);
-  if (err)
-    error (1, err, "Getting host architecture from Mach");
-#endif
-
   task_get_bootstrap_port (mach_task_self (), &bootstrap);
   if (bootstrap == MACH_PORT_NULL)
     error (2, 0, "Must be started as a translator");
diff --git a/libdiskfs/file-set-size.c b/libdiskfs/file-set-size.c
index 18abb46..fe2125a 100644
--- a/libdiskfs/file-set-size.c
+++ b/libdiskfs/file-set-size.c
@@ -26,7 +26,7 @@ diskfs_S_file_set_size (struct protid *cred,
 {
   CHANGE_NODE_FIELD (cred,
                     ({
-                      if (!(cred->po->openstat & O_WRITE))
+                      if (!(cred->po->openstat & O_WRITE) || (size < 0))
                         err = EINVAL;
                       else if (size < np->dn_stat.st_size)
                         {
diff --git a/libdiskfs/ifsock.c b/libdiskfs/ifsock.c
index 9199fdf..01a9b1e 100644
--- a/libdiskfs/ifsock.c
+++ b/libdiskfs/ifsock.c
@@ -121,7 +121,7 @@ diskfs_S_ifsock_getsockaddr (struct protid *cred,
          if (old != MACH_PORT_NULL)
            mach_port_deallocate (mach_task_self (), old);
          np->sockaddr = sockaddr;
-         diskfs_nref (np);
+         diskfs_nref_light (np);
        }
     }      
   
diff --git a/libdiskfs/node-nput.c b/libdiskfs/node-nput.c
index 35f05b5..5043ad1 100644
--- a/libdiskfs/node-nput.c
+++ b/libdiskfs/node-nput.c
@@ -56,6 +56,12 @@ diskfs_nput (struct node *np)
          np->references++;
          pthread_spin_unlock (&diskfs_node_refcnt_lock);
 
+         if (np->sockaddr != MACH_PORT_NULL)
+           {
+             mach_port_deallocate (mach_task_self (), np->sockaddr);
+             np->sockaddr = MACH_PORT_NULL;
+           }
+
          diskfs_try_dropping_softrefs (np);
 
          /* But there's no value in looping forever in this
diff --git a/libfshelp/translator-list.c b/libfshelp/translator-list.c
index 99a858f..87dcb21 100644
--- a/libfshelp/translator-list.c
+++ b/libfshelp/translator-list.c
@@ -47,9 +47,12 @@ static pthread_mutex_t translator_ihash_lock = 
PTHREAD_MUTEX_INITIALIZER;
 static void
 translator_ihash_cleanup (void *element, void *arg)
 {
+  struct translator *translator = element;
+
   /* No need to deallocate port, we only keep the name of the
      port, not a reference.  */
-  free (element);
+  free (translator->name);
+  free (translator);
 }
 
 /* Record an active translator being bound to the given file name
diff --git a/libnetfs/dir-lookup.c b/libnetfs/dir-lookup.c
index 10ea2d0..74351fa 100644
--- a/libnetfs/dir-lookup.c
+++ b/libnetfs/dir-lookup.c
@@ -277,15 +277,13 @@ netfs_S_dir_lookup (struct protid *diruser,
 
          if (error != ENOENT)
            {
-             netfs_nrele (dnp);
-             netfs_nput (np);
              *retry_port_type = MACH_MSG_TYPE_MOVE_SEND;
              if (!lastcomp && !error)
                {
                  strcat (retry_name, "/");
                  strcat (retry_name, nextname);
                }
-             return error;
+             goto out;
            }
 
          /* ENOENT means there was a hiccup, and the translator vanished
diff --git a/libnetfs/file-set-size.c b/libnetfs/file-set-size.c
index 72f31db..b4a8cd2 100644
--- a/libnetfs/file-set-size.c
+++ b/libnetfs/file-set-size.c
@@ -29,6 +29,8 @@ netfs_S_file_set_size (struct protid *user,
   
   if (!user)
     return EOPNOTSUPP;
+  else if (size < 0)
+    return EINVAL;
   
   pthread_mutex_lock (&user->po->np->lock);
   err = netfs_attempt_set_size (user->user, user->po->np, size);
diff --git a/libports/create-internal.c b/libports/create-internal.c
index c60f6fd..572a55a 100644
--- a/libports/create-internal.c
+++ b/libports/create-internal.c
@@ -109,10 +109,11 @@ _ports_create_port_internal (struct port_class *class,
   err = EINTR;
  lose:
   pthread_mutex_unlock (&_ports_lock);
- lose_unlocked:
-  err = mach_port_mod_refs (mach_task_self (), port,
-                           MACH_PORT_RIGHT_RECEIVE, -1);
-  assert_perror (err);
+ lose_unlocked:;
+  error_t e;
+  e = mach_port_mod_refs (mach_task_self (), port,
+                         MACH_PORT_RIGHT_RECEIVE, -1);
+  assert_perror (e);
   free (pi);
 
   return err;
diff --git a/libshouldbeinlibc/maptime.c b/libshouldbeinlibc/maptime.c
index bc75045..cacf4b6 100644
--- a/libshouldbeinlibc/maptime.c
+++ b/libshouldbeinlibc/maptime.c
@@ -47,6 +47,8 @@ maptime_map (int use_mach_dev, char *dev_name,
        {
          err = device_open (device_master, 0, dev_name ?: "time", &device);
          mach_port_deallocate (mach_task_self (), device_master);
+         if (err)
+           return err;
        }
 
       err = device_map (device, VM_PROT_READ, 0, sizeof *mtime, &memobj, 0);
diff --git a/libtreefs/s-file.c b/libtreefs/s-file.c
index 73c32d7..c24d645 100644
--- a/libtreefs/s-file.c
+++ b/libtreefs/s-file.c
@@ -220,6 +220,8 @@ treefs_S_file_set_size (struct treefs_protid *cred, off_t 
size)
 {
   if (!cred)
     return EOPNOTSUPP;
+  else if (size < 0)
+    return EINVAL;
   return treefs_s_file_set_size (cred, size);
 }
 
diff --git a/libtrivfs/protid-clean.c b/libtrivfs/protid-clean.c
index 856d7af..a9623a3 100644
--- a/libtrivfs/protid-clean.c
+++ b/libtrivfs/protid-clean.c
@@ -23,26 +23,27 @@ void
 trivfs_clean_protid (void *arg)
 {
   struct trivfs_protid *cred = arg;
-  
+  struct trivfs_control *cntl = cred->po->cntl;
+
   if (trivfs_protid_destroy_hook && cred->realnode != MACH_PORT_NULL)
     /* Allow the user to clean up; If the realnode field is null, then CRED
        wasn't initialized to the point of needing user cleanup.  */
     (*trivfs_protid_destroy_hook) (cred);
 
   /* If we hold the only reference to the peropen, try to get rid of it. */
-  pthread_mutex_lock (&cred->po->cntl->lock);
+  pthread_mutex_lock (&cntl->lock);
   if (cred->po->refcnt == 1 && trivfs_peropen_destroy_hook)
     {
-      pthread_mutex_unlock (&cred->po->cntl->lock);
+      pthread_mutex_unlock (&cntl->lock);
       (*trivfs_peropen_destroy_hook) (cred->po);
-      pthread_mutex_lock (&cred->po->cntl->lock);
+      pthread_mutex_lock (&cntl->lock);
     }
   if (--cred->po->refcnt == 0)
     {
-      ports_port_deref (cred->po->cntl);
+      ports_port_deref (cntl);
       free (cred->po);
     }
-  pthread_mutex_unlock (&cred->po->cntl->lock);
+  pthread_mutex_unlock (&cntl->lock);
 
   iohelp_free_iouser (cred->user);
 
diff --git a/pflocal/sock.c b/pflocal/sock.c
index 2641e1c..8076dd3 100644
--- a/pflocal/sock.c
+++ b/pflocal/sock.c
@@ -294,12 +294,16 @@ sock_bind (struct sock *sock, struct addr *addr)
     {
       sock->addr = addr;
       if (addr)
-       sock->refs++;
+       {
+         sock->refs++;
+         ports_port_ref_weak (addr);
+       }
       if (old_addr)
        {
          /* Note that we don't have to worry about SOCK's ref count going to
             zero because whoever's calling us should be holding a ref.  */
          sock->refs--;
+         ports_port_deref_weak (addr);
          assert (sock->refs > 0);      /* But make sure... */
        }
     }
diff --git a/pflocal/socket.c b/pflocal/socket.c
index 6723734..7142c6e 100644
--- a/pflocal/socket.c
+++ b/pflocal/socket.c
@@ -401,7 +401,7 @@ S_socket_recv (struct sock_user *user,
     /* Setup mach ports for return.  */
     {
       *addr_type = MACH_MSG_TYPE_MAKE_SEND;
-      *ports_type = MACH_MSG_TYPE_COPY_SEND;
+      *ports_type = MACH_MSG_TYPE_MOVE_SEND;
       if (source_addr)
        {
          *addr = ports_get_right (source_addr);
@@ -411,8 +411,7 @@ S_socket_recv (struct sock_user *user,
        *addr = MACH_PORT_NULL;
     }
 
-  /* Fill in OUT_FLAGS from from any corresponding ones in FLAGS.  */
-  out_flags = 0;
+  *out_flags = 0;
 
   return err;
 }
diff --git a/procfs/rootdir.c b/procfs/rootdir.c
index 34bf91c..94b0ddb 100644
--- a/procfs/rootdir.c
+++ b/procfs/rootdir.c
@@ -407,6 +407,47 @@ rootdir_gc_fakeself (void *hook, char **contents, ssize_t 
*contents_len)
 /* The mtab translator to use by default for the "mounts" node.  */
 #define MTAB_TRANSLATOR        "/hurd/mtab"
 
+static struct node *rootdir_mounts_node;
+static pthread_spinlock_t rootdir_mounts_node_lock =
+  PTHREAD_SPINLOCK_INITIALIZER;
+
+static struct node *
+rootdir_mounts_make_node (void *dir_hook, const void *entry_hook)
+{
+  struct node *np, *prev;
+
+  pthread_spin_lock (&rootdir_mounts_node_lock);
+  np = rootdir_mounts_node;
+  pthread_spin_unlock (&rootdir_mounts_node_lock);
+
+  if (np != NULL)
+    {
+      netfs_nref (np);
+      return np;
+    }
+
+  np = procfs_make_node (entry_hook, dir_hook);
+  if (np == NULL)
+    return NULL;
+
+  procfs_node_chtype (np, S_IFREG | S_IPTRANS);
+  procfs_node_chmod (np, 0444);
+
+  pthread_spin_lock (&rootdir_mounts_node_lock);
+  prev = rootdir_mounts_node;
+  if (rootdir_mounts_node == NULL)
+    rootdir_mounts_node = np;
+  pthread_spin_unlock (&rootdir_mounts_node_lock);
+
+  if (prev != NULL)
+    {
+      procfs_cleanup (np);
+      np = prev;
+    }
+
+  return np;
+}
+
 static error_t
 rootdir_mounts_get_translator (void *hook, char **argz, size_t *argz_len)
 {
@@ -451,18 +492,6 @@ rootdir_symlink_make_node (void *dir_hook, const void 
*entry_hook)
   return np;
 }
 
-static struct node *
-rootdir_translator_make_node (void *dir_hook, const void *entry_hook)
-{
-  struct node *np = procfs_make_node (entry_hook, dir_hook);
-  if (np)
-    {
-      procfs_node_chtype (np, S_IFREG | S_IPTRANS);
-      procfs_node_chmod (np, 0444);
-    }
-  return np;
-}
-
 static const struct procfs_dir_entry rootdir_entries[] = {
   {
     .name = "self",
@@ -530,7 +559,7 @@ static const struct procfs_dir_entry rootdir_entries[] = {
       .get_translator = rootdir_mounts_get_translator,
     },
     .ops = {
-      .make_node = rootdir_translator_make_node,
+      .make_node = rootdir_mounts_make_node,
       .exists = rootdir_mounts_exists,
     }
   },
diff --git a/storeio/io.c b/storeio/io.c
index c79f6ba..eaa20de 100644
--- a/storeio/io.c
+++ b/storeio/io.c
@@ -178,6 +178,8 @@ trivfs_S_file_set_size (struct trivfs_protid *cred,
 {
   if (! cred)
     return EOPNOTSUPP;
+  else if (size < 0)
+    return EINVAL;
   else
     return 0;
 }
diff --git a/term/ptyio.c b/term/ptyio.c
index 44a215b..2da7d6c 100644
--- a/term/ptyio.c
+++ b/term/ptyio.c
@@ -331,6 +331,12 @@ pty_io_read (struct trivfs_protid *cred,
        }
     }
 
+  if (!(termflags & TTY_OPEN))
+    {
+      pthread_mutex_unlock (&global_lock);
+      return EIO;
+    }
+
   if (control_byte)
     {
       size = 1;
diff --git a/term/users.c b/term/users.c
index 9d745c6..eacd150 100644
--- a/term/users.c
+++ b/term/users.c
@@ -1808,6 +1808,8 @@ trivfs_S_file_set_size (struct trivfs_protid *cred,
 {
   if (!cred)
     return EOPNOTSUPP;
+  else if (size < 0)
+    return EINVAL;
   pthread_mutex_lock (&global_lock);
   if ((cred->po->openmodes & O_WRITE) == 0)
     {
diff --git a/tmpfs/tmpfs.c b/tmpfs/tmpfs.c
index 1872a7d..7da3dd5 100644
--- a/tmpfs/tmpfs.c
+++ b/tmpfs/tmpfs.c
@@ -29,7 +29,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 
02139, USA.  */
 #include <fcntl.h>
 #include <hurd.h>
 #include <hurd/paths.h>
-#include <nullauth.h>
 
 char *diskfs_server_name = "tmpfs";
 char *diskfs_server_version = HURD_VERSION;
@@ -438,11 +437,6 @@ main (int argc, char **argv)
   /* We must keep the REALNODE send right to remain the active
      translator for the underlying node.  */
 
-  /* Drop all privileges.  */
-  err = setnullauth();
-  if (err)
-    error (1, err, "Could not drop privileges");
-
   pthread_mutex_unlock (&diskfs_root_node->lock);
 
   /* and so we die, leaving others to do the real work.  */
diff --git a/trans/mtab.c b/trans/mtab.c
index 2973a0b..250de7d 100644
--- a/trans/mtab.c
+++ b/trans/mtab.c
@@ -37,7 +37,7 @@
 
 #include "fsys_U.h"
 
-static char *path = NULL;
+static char *target_path = NULL;
 static int insecure = 0;
 
 /* Our control port.  */
@@ -71,8 +71,8 @@ error_t parse_opt (int key, char *arg, struct argp_state 
*state)
       break;
 
     case ARGP_KEY_ARG:
-      path = realpath (arg, NULL);
-      if (! path)
+      target_path = realpath (arg, NULL);
+      if (! target_path)
        argp_error (state, "Error while canonicalizing path");
       break;
 
@@ -105,12 +105,12 @@ trivfs_append_args (struct trivfs_control *fsys,
 
   if (insecure)
     {
-      err = argz_add (argz, argz_len, path);
+      err = argz_add (argz, argz_len, target_path);
       if (err)
        return err;
     }
 
-  err = argz_add (argz, argz_len, path);
+  err = argz_add (argz, argz_len, target_path);
   return err;
 }
 
@@ -241,9 +241,9 @@ main (int argc, char *argv[])
     {
       /* One-shot mode.         */
       struct mtab mtab = { NULL, 0, 0 };
-      err = mtab_populate (&mtab, path, insecure);
+      err = mtab_populate (&mtab, target_path, insecure);
       if (err)
-       error (5, err, "%s", path);
+       error (5, err, "%s", target_path);
 
       if (mtab.contents)
        printf ("%s", mtab.contents);
@@ -594,7 +594,7 @@ open_hook (struct trivfs_peropen *peropen)
   mtab->contents = NULL;
   mtab->contents_len = 0;
 
-  return mtab_populate (mtab, path, insecure);
+  return mtab_populate (mtab, target_path, insecure);
 }
 
 static void
diff --git a/trans/null.c b/trans/null.c
index 8b3b4e0..4828cce 100644
--- a/trans/null.c
+++ b/trans/null.c
@@ -245,6 +245,8 @@ trivfs_S_file_set_size (struct trivfs_protid *cred,
                        mach_port_t reply, mach_msg_type_name_t replytype,
                        loff_t size)
 {
+  if (size < 0)
+    return EINVAL;
   return 0;
 }
 
diff --git a/trans/streamio.c b/trans/streamio.c
index 8ff3dc6..68badd2 100644
--- a/trans/streamio.c
+++ b/trans/streamio.c
@@ -625,6 +625,8 @@ trivfs_S_file_set_size (struct trivfs_protid *cred,
     return EOPNOTSUPP;
   else if (!(cred->po->openmodes & O_WRITE))
     return EBADF;
+  else if (size < 0)
+    return EINVAL;
   else
     return 0;
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-hurd/hurd.git



reply via email to

[Prev in Thread] Current Thread [Next in Thread]