[Top][All Lists]

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

pflocal/socket.c(S_socket_connect function) question

From: PUYDT Julien
Subject: pflocal/socket.c(S_socket_connect function) question
Date: 13 Jan 2003 21:22:17 +0100


I was reading the sources of pflocal, to learn more about the Hurd
internals, when I encountered the following piece of code:
S_socket_connect (struct sock_user *user, struct addr *addr)
  error_t err;
  struct sock *peer;

  if (! addr)
    return ECONNREFUSED;

  /* Deallocate ADDR's send right, which we get as a side effect of the
rpc. */
  mach_port_deallocate (mach_task_self (),
                        ((struct port_info *)addr)->port_right);

  if (! user)
    return EOPNOTSUPP;


Why is that port deallocated _before_ user is tested for validity? Is it
unimportant? Why? I would have expected that both addr and user would be
tested before anything is done...

Snark on #hurd

reply via email to

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