On Fri, Oct 18, 2013 at 11:31:37AM +0900, YAMAMOTO Takashi wrote:
> > +/* Attempts to shorten 'name' by creating a symlink for the directory part 
> > of
> > + * the name and indirecting through <symlink>/<basename>.  This works on
> > + * systems that support symlinks, as long as <basename> isn't too long.
> > + *
> > + * On success, returns 0 and stores the short name in 'short_name' and the
> > + * symbolic link to eventually delete in 'linkname'. */
> > +static int
> > +shorten_name_via_symlink(const char *name, char short_name[MAX_UN_LEN + 1],
> > +                         char linkname[MAX_UN_LEN + 1])
> > +{
> > +    char *abs, *dir, *base;
> > +    const char *tmpdir;
> > +    int error;
> > +    int i;
> > +
> > +    abs = abs_file_name(NULL, name);
> > +    dir = dir_name(abs);
> > +    base = base_name(abs);
> > +    free(abs);
> > +
> > +    tmpdir = getenv("TMPDIR");
> > +    if (tmpdir == NULL) {
> > +        tmpdir = "/tmp";
> > +    }
> > +
> > +    for (i = 0; i < 10; i++) {
> 
> i feel that 10 is too small as number of unix sockets ovs can use
> is larger in magnitude.  while simultaneous use of this should be
> typically much smaller, it shouldn't be a problem to waste cycles
> here either.  IMO safer is better.

I think that 10 sequential random number collisions in a 32-bit space is
more than a coincidence.  However, 1000 doesn't hurt, so I changed it
back.

> >              VLOG_WARN_RL(&rl, "Unix socket name %s is longer than maximum "
> > -                         "%d bytes (even shortened)", name, MAX_UN_LEN);
> > -        } else {
> > -            /* 'name' is too long and we have no workaround. */
> > -            VLOG_WARN_RL(&rl, "Unix socket name %s is longer than maximum "
> >                           "%d bytes", name, MAX_UN_LEN);
> 
> with your new definition of MAX_UN_LEN, this should be %zu.

Thanks for pointing that out.

> otherwise looks good to me and worked for me.  thanks!

Great, I'll push this in a minute.
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to