[EMAIL PROTECTED] wrote:
if (domain <= max_domain)
- servers[domain] = server;
+ servers[domain] = server;
I'm not sure about this, but I think it is usually better to avoid
changing the indentation of code you haven't otherwise touched -- even
if it was wrong before..
[EMAIL PROTECTED], le Mon 25 Aug 2008 21:59:02 +0200, a écrit :
> On Fri, Aug 22, 2008 at 11:46:52AM +0200, Da Zheng wrote:
> > [EMAIL PROTECTED] wrote:
> >> On Tue, Aug 19, 2008 at 03:27:06PM +0200, zhengda wrote:
>
> >>> - socket_t server;
> >>> + socket_t server = MACH_PORT_NULL;
> >>
> >> As
hi,
On Fri, Aug 22, 2008 at 11:46:52AM +0200, Da Zheng wrote:
> [EMAIL PROTECTED] wrote:
>> On Tue, Aug 19, 2008 at 03:27:06PM +0200, zhengda wrote:
>>> - socket_t server;
>>> + socket_t server = MACH_PORT_NULL;
>>
>> As I already said, this is unnecessary -- it will be assigned
>> unconditiona
[EMAIL PROTECTED] wrote:
Hi,
On Tue, Aug 19, 2008 at 03:27:06PM +0200, zhengda wrote:
- socket_t server;
+ socket_t server = MACH_PORT_NULL;
As I already said, this is unnecessary -- it will be assigned
unconditionally.
It's necessary here. If __asprintf() returns -1, the funct
Hi,
On Tue, Aug 19, 2008 at 03:27:06PM +0200, zhengda wrote:
> - socket_t server;
> + socket_t server = MACH_PORT_NULL;
As I already said, this is unnecessary -- it will be assigned
unconditionally.
> + if (__asprintf (&name, "%s/%d", sock_servs, domain) < 0)
> + goto out;
In
Samuel Thibault wrote:
zhengda, le Sun 17 Aug 2008 13:40:59 +0200, a écrit :
I wonder how I return ENOMEM? Does asprintf() write the errno itself?
Yes.
Should the function returns immediately after __asprintf() returns error?
It has to clean its mess first of course.
He
Hi,
On Sun, Aug 17, 2008 at 01:57:18PM +0200, zhengda wrote:
> [EMAIL PROTECTED] wrote:
>> It really depends on the context. In some cases -- if the pointer is
>> dereferenced -- NULL will create an obvious failure, while some
>> random uninitialized pointer might be harder to track down.
>>
>> I
zhengda, le Sun 17 Aug 2008 13:40:59 +0200, a écrit :
> I wonder how I return ENOMEM? Does asprintf() write the errno itself?
Yes.
> Should the function returns immediately after __asprintf() returns error?
It has to clean its mess first of course.
Samuel
zhengda, le Sun 17 Aug 2008 13:57:18 +0200, a écrit :
> My first C language teacher told me to initialize all local variables,
> especially the pointers,
That's probably some rule of the thumb for beginners, but we're not
supposed to be beginners (hey, that's the C library! ;) )
Samuel
[EMAIL PROTECTED] wrote:
It really depends on the context. In some cases -- if the pointer is
dereferenced -- NULL will create an obvious failure, while some random
uninitialized pointer might be harder to track down.
In other cases -- if it's used as argument to realloc(), free() etc.; or
if i
Samuel Thibault wrote:
zhengda, le Fri 15 Aug 2008 20:05:53 +0200, a écrit :
Samuel Thibault wrote:
zhengda, le Fri 15 Aug 2008 19:05:49 +0200, a écrit :
Samuel Thibault wrote:
zhengda, le Fri 15 Aug 2008 18:27:00 +0200, a écrit :
+ if (__
Hi,
On Fri, Aug 15, 2008 at 06:27:00PM +0200, zhengda wrote:
> [EMAIL PROTECTED] wrote:
>>> But isn't it always right to initialize a local variable to reduce
>>> the possibility of getting bugs?
>>
>> It won't avoid bugs; only either cover them up, or (less likely)
>> expose them more clearly -
zhengda, le Fri 15 Aug 2008 20:05:53 +0200, a écrit :
> Samuel Thibault wrote:
> >zhengda, le Fri 15 Aug 2008 19:05:49 +0200, a écrit :
> >
> >>Samuel Thibault wrote:
> >>
> >>>zhengda, le Fri 15 Aug 2008 18:27:00 +0200, a écrit :
> >>>
> >>>
> + if (__asprintf (&name, "SOCK_S
Samuel Thibault wrote:
zhengda, le Fri 15 Aug 2008 19:05:49 +0200, a écrit :
Samuel Thibault wrote:
zhengda, le Fri 15 Aug 2008 18:27:00 +0200, a écrit :
+ if (__asprintf (&name, "SOCK_SERV_%d", domain) < 0)
+__libc_fatal ("hurd: Can't get the socket server path\n");
zhengda, le Fri 15 Aug 2008 19:05:49 +0200, a écrit :
> Samuel Thibault wrote:
> >zhengda, le Fri 15 Aug 2008 18:27:00 +0200, a écrit :
> >
> >>+ if (__asprintf (&name, "SOCK_SERV_%d", domain) < 0)
> >>+__libc_fatal ("hurd: Can't get the socket server path\n");
> >>
> >
> >Shouldn't
Samuel Thibault wrote:
zhengda, le Fri 15 Aug 2008 18:27:00 +0200, a écrit :
+ if (__asprintf (&name, "SOCK_SERV_%d", domain) < 0)
+__libc_fatal ("hurd: Can't get the socket server path\n");
Shouldn't we just return ENOMEM?
In many parts of glibc, __libc_fatal() or assert(
zhengda, le Fri 15 Aug 2008 18:27:00 +0200, a écrit :
> + if (__asprintf (&name, "SOCK_SERV_%d", domain) < 0)
> +__libc_fatal ("hurd: Can't get the socket server path\n");
Shouldn't we just return ENOMEM?
Samuel
[EMAIL PROTECTED] wrote:
+ char *name = NULL;
No need to initialize this -- the asprintf() will overwrite it anyways.
But isn't it always right to initialize a local variable to reduce the
possibility of getting bugs?
It won't avoid bugs; only either cover t
Hi,
On Wed, Aug 13, 2008 at 01:49:41PM +0200, zhengda wrote:
> Neal H. Walfield wrote:
>> Check if the result is != -1, not > 0, which has a different meaning.
>>
> + if (__asprintf (&name, "%s/%d", sock_servs, domain) > 0)
> + np = name;
>>
> but it's still wrong
Hi,
On Wed, Aug 13, 2008 at 12:41:12PM +0200, zhengda wrote:
> [EMAIL PROTECTED] wrote:
>> On Tue, Aug 12, 2008 at 08:05:49PM +0200, zhengda wrote:
>>> + char *name = NULL;
>>>
>>
>> No need to initialize this -- the asprintf() will overwrite it anyways.
>>
> But isn't it always righ
zhengda, le Wed 13 Aug 2008 13:49:41 +0200, a écrit :
> but it's still wrong that __asprintf returns 0 in my code, isn't it?
That shall not happen.
In such a case anyway, you'd still have to free it.
Samuel
Neal H. Walfield wrote:
At Wed, 13 Aug 2008 12:41:12 +0200,
zhengda wrote:
+ if (__asprintf (&name, "SOCK_SERV_%d", domain) > 0)
+{
+ np = getenv (name);
+ __free (name);
+}
You need to check whether asprintf() returns an error code (-1),
At Wed, 13 Aug 2008 12:41:12 +0200,
zhengda wrote:
> >> + if (__asprintf (&name, "SOCK_SERV_%d", domain) > 0)
> >> +{
> >> + np = getenv (name);
> >> + __free (name);
> >> +}
> >>
> >
> > You need to check whether asprintf() returns an error code (-1), me
[EMAIL PROTECTED] wrote:
Hi,
On Tue, Aug 12, 2008 at 08:05:49PM +0200, zhengda wrote:
+ char *name = NULL;
No need to initialize this -- the asprintf() will overwrite it anyways.
But isn't it always right to initialize a local variable to reduce the
possibility of getting bu
Hi,
On Tue, Aug 12, 2008 at 08:05:49PM +0200, zhengda wrote:
> + char *name = NULL;
No need to initialize this -- the asprintf() will overwrite it anyways.
> + if (__asprintf (&name, "SOCK_SERV_%d", domain) > 0)
> +{
> + np = getenv (name);
> + __free (name);
The new patch of glibc to override the default socket server:
Needed for glibc-2_7-branch
2008-06-30 Zheng Da <[EMAIL PROTECTED]>
* hurd/hurdsocks.c (_hurd_socket_server): Searches environment variables
for the socket server insteading of using the default one.
(SOCK_SERV_%d, SOCK_SER
Samuel Thibault wrote:
zhengda, le Sun 10 Aug 2008 19:42:18 +0200, a écrit :
Samuel Thibault wrote:
if (domain > max_domain || servers[domain] == MACH_PORT_NULL)
{
char *name = NULL;
char *np = NULL;
if (__asprintf (&name, "SOCK_SERV_%d", domain) > 0)
{
np = geten
zhengda, le Sun 10 Aug 2008 19:42:18 +0200, a écrit :
> Samuel Thibault wrote:
> if (domain > max_domain || servers[domain] == MACH_PORT_NULL)
> {
> char *name = NULL;
> char *np = NULL;
>
> if (__asprintf (&name, "SOCK_SERV_%d", domain) > 0)
> {
> np = getenv (name);
>
Samuel Thibault wrote:
zhengda, le Sun 10 Aug 2008 20:07:57 +0200, a écrit :
Samuel Thibault wrote:
zhengda, le Sun 10 Aug 2008 19:42:18 +0200, a écrit :
But I don't understand why. Obviously, 'name' isn't double-freed.
Mmm, maybe you have a glibc that is partly
zhengda, le Sun 10 Aug 2008 20:07:57 +0200, a écrit :
> Samuel Thibault wrote:
> >zhengda, le Sun 10 Aug 2008 19:42:18 +0200, a écrit :
> >
> >>But I don't understand why. Obviously, 'name' isn't double-freed.
> >>
> >
> >Mmm, maybe you have a glibc that is partly compiled with debugging on
>
Samuel Thibault wrote:
zhengda, le Sun 10 Aug 2008 19:42:18 +0200, a écrit :
But I don't understand why. Obviously, 'name' isn't double-freed.
Mmm, maybe you have a glibc that is partly compiled with debugging on
and partly compiled with debugging off?
How can that happen?
If so, w
zhengda, le Sun 10 Aug 2008 19:42:18 +0200, a écrit :
> But I don't understand why. Obviously, 'name' isn't double-freed.
Mmm, maybe you have a glibc that is partly compiled with debugging on
and partly compiled with debugging off?
Samuel
Samuel Thibault wrote:
Gah. Then set from inside gdb:
gdb --args /root/storage/glibc-2.7/build-tree/hurd-i386-libc/sunrpc/rpcgen -Y
../scripts -c rpcsvc/bootparam_prot.x -o
/root/storage/glibc-2.7/build-tree/hurd-i386-libc/sunrpc/xbootparam_prot.T
(gdb) set environment
LD_LIBRARY_PATH=/root
zhengda, le Sun 10 Aug 2008 18:55:48 +0200, a écrit :
> >LD_LIBRARY_PATH=/root/storage/glibc-2.7/build-tree/hurd-i386-libc gdb
> >--args /root/storage/glibc-2.7/build-tree/hurd-i386-libc/sunrpc/rpcgen -Y
> >../scripts -c rpcsvc/bootparam_prot.x -o
> >/root/storage/glibc-2.7/build-tree/hurd-i386-
Samuel Thibault wrote:
zhengda, le Sat 09 Aug 2008 13:59:19 +0200, a écrit :
if (name)
free (name);
No need for an if here, free(NULL); is void already.
OK
When I build the glibc, I got the error as follow:
CPP='gcc-4.2 -E -x c-header'
/root/storage/glibc-2.7/build-
zhengda, le Sat 09 Aug 2008 13:59:19 +0200, a écrit :
> if (name)
>free (name);
No need for an if here, free(NULL); is void already.
> When I build the glibc, I got the error as follow:
>
> CPP='gcc-4.2 -E -x c-header'
> /root/storage/glibc-2.7/build-tree/hurd-i386-libc/elf/ld.so.
Samuel Thibault wrote:
Hello,
+ char sock_serv_env_name[30];
To avoid a fixed-sized buffer you could use __asprintf.
+ name = (char *)malloc (len + 100);
Use __asprintf here too.
- servers[domain] = server;
+servers[domain] = server;
Hello,
> + char sock_serv_env_name[30];
To avoid a fixed-sized buffer you could use __asprintf.
> + name = (char *)malloc (len + 100);
Use __asprintf here too.
> - servers[domain] = server;
> +servers[domain] = server;
Spurious hook, please try to minimize these.
A
Hi,
On Wed, Jul 09, 2008 at 02:02:18PM +0200, zhengda wrote:
> I also write a SHELL script "runwithpfinet" to set the environment
> variables and run the command provided by the user.
[...]
> It works in most of cases. but it doesn't work with "ping" when the
> user execute "runwithpfinet 1 ping
Hi,
On Tue, Jul 08, 2008 at 01:15:11AM +0200, zhengda wrote:
> The patch is
> http://www.assembla.com/spaces/VNetHurd/documents/aJidqKp6ur3z-Nab7jnrAJ/download/A%20patch%20of%20glibc
Well, sending patches inline is generally a better idea...
At least the whitespace in the diff is not mangled th
zhengda wrote:
Neal H. Walfield wrote:
If more network protocols are implemented, we have to provide more
environment variables for the servers.
Or you use an environment variable that is based on a stem and the
protocol number. So instead of SOCK_INET_SERV_PATH,
SOCK_SERV_%d_PATH. Perh
[EMAIL PROTECTED] wrote:
Hi,
On Wed, Jul 02, 2008 at 08:42:43PM +0200, zhengda wrote:
The new version of the patch is below.
Hm, what about dropping/replacing the "_PATH" bit, as discussed in the
other subthread?...
OK.
I wonder if I can use __snprintf(). The code in the orig
Hi,
On Wed, Jul 02, 2008 at 08:42:43PM +0200, zhengda wrote:
> The new version of the patch is below.
Hm, what about dropping/replacing the "_PATH" bit, as discussed in the
other subthread?...
> I wonder if I can use __snprintf(). The code in the original glibc
> doesn't use it.
I'm not a glib
Hi,
On Mon, Jun 30, 2008 at 02:39:23PM +0200, zhengda wrote:
> Kalle Olavi Niemitalo wrote:
>> http://www.gnu.org/prep/standards/standards.html#GNU-Manuals
>>
>> # Please do not use the term ???pathname??? that is used in Unix #
>> documentation; use ???file name??? (two words) instead. We use th
Hi,
On Mon, Jun 30, 2008 at 03:14:47PM +0200, zhengda wrote:
> [EMAIL PROTECTED] wrote:
>>> Do you mean the indentation here? It is caused by '-' and '+' in the
>>> beginning of lines.
>>>
>>
>> Ah, I see it now. That shouldn't happen, though. How did you generate
>> the patch?
>>
> for
Neal H. Walfield wrote:
If more network protocols are implemented, we have to provide more
environment variables for the servers.
Or you use an environment variable that is based on a stem and the
protocol number. So instead of SOCK_INET_SERV_PATH,
SOCK_SERV_%d_PATH. Perhaps it is best t
[EMAIL PROTECTED] wrote:
Do you mean the indentation here? It is caused by '-' and '+' in the
beginning of lines.
Ah, I see it now. That shouldn't happen, though. How did you generate
the patch?
for this case, I use
diff -u glibc-2.7-old/hurd/hurdsock.c glibc-2.7/hurd/hurdsock.c
Zhen
Kalle Olavi Niemitalo wrote:
zhengda <[EMAIL PROTECTED]> writes:
Anyway, I provide two more environment variables SOCK_INET_SERV_PATH
and SOCK_LOCAL_SERV_PATH for the pfinet server and pflocal server,
respectively.
I try to make my code meet the GNU coding standard.
http://www.gnu.org
zhengda <[EMAIL PROTECTED]> writes:
> Anyway, I provide two more environment variables SOCK_INET_SERV_PATH
> and SOCK_LOCAL_SERV_PATH for the pfinet server and pflocal server,
> respectively.
> I try to make my code meet the GNU coding standard.
http://www.gnu.org/prep/standards/standards.html#GN
Hi,
On Thu, Jun 26, 2008 at 07:31:12PM +0200, zhengda wrote:
> [EMAIL PROTECTED] wrote:
>> If we want to override the TCP/IP stack, that doesn't mean we want to
>> override the pipe server as well, or the other way round...
>>
> I think using the symbolic link to the default server is another
zhengda, le Thu 26 Jun 2008 19:31:12 +0200, a écrit :
> >Hm... Something seems wrong with the indentation here -- but it looks as
> >if it has been already wrong in the original code... Can you fix that
> >please?
> >
> >Oh, and of course you still need a changelog entry. There is a section
> >in t
[EMAIL PROTECTED] wrote:
Hi,
On Wed, Jun 25, 2008 at 04:44:51PM +0200, zhengda wrote:
Neal H. Walfield wrote:
Yes of course. If we want to override the TCP/IP stack, that doesn't
mean we want to override the pipe server as well, or the other way
round...
I think using the symbolic link t
Hi,
On Wed, Jun 25, 2008 at 04:44:51PM +0200, zhengda wrote:
> Neal H. Walfield wrote:
>> This works in the case where you want to override all pf servers.
>> This case is important. Also important is the ability to override a
>> single pf server in a similar manner.
> I wonder if it's really n
At Wed, 25 Jun 2008 16:44:51 +0200,
zhengda wrote:
> I wonder if it's really necessary to override a single pf server.
When porting pppd, I did this regularly; I used an alternative pfinet
server but continued to use the default pipe server. I don't see why
you think it would be normal to want to
Neal H. Walfield wrote:
This works in the case where you want to override all pf servers.
This case is important. Also important is the ability to override a
single pf server in a similar manner.
A couple comments on the code: please follow the GNU coding standards.
Second, I assume that you le
This works in the case where you want to override all pf servers.
This case is important. Also important is the ability to override a
single pf server in a similar manner.
A couple comments on the code: please follow the GNU coding standards.
Second, I assume that you left the #if 0 in because yo
Hi,
I modified the code of glibc, so the user can override the default
pfinet server by using the environment variable.
Here is the patch:
--- glibc-2.7-old/hurd/hurdsock.c2008-06-21 01:38:30.04000 +0200
+++ glibc-2.7/hurd/hurdsock.c2008-06-21 01:45:28.34000 +0200
@@ -76,6 +76,3
57 matches
Mail list logo