[Samba] Samba 4.2.0rc4 fails to start up
Jeremy Allison
jra at samba.org
Tue Feb 10 22:07:28 MST 2015
On Tue, Feb 10, 2015 at 08:59:21PM -0800, Jeremy Allison wrote:
> On Tue, Feb 10, 2015 at 10:25:06PM -0500, Thomas Schulz wrote:
> >
> > DEBUG(1, ("unique is %u\n", unique));
> > unique_len = snprintf(buf, sizeof(buf), "%ju\n", (uintmax_t)unique);
> > DEBUG(1, ("unique_len is: %i\n", unique_len));
> >
> > /* shorten a potentially preexisting file */
> >
> > ret = ftruncate(lockfile_fd, unique_len);
> > if (ret == -1) {
> > ret = errno;
> > DEBUG(1, ("%s: ftruncate failed: %s\n", __func__,
> > strerror(ret)));
> > goto fail_unlink;
> > }
> >
> > And the output of ./smbd -i -d 2 is:
> >
> > lock file name is: /opt/local/samba4/var/cache/lck/7561
> > unique is 0
> > unique_len is: -1
> > messaging_dgm_lockfile_create: ftruncate failed: Invalid argument
> > messaging_dgm_init: messaging_dgm_create_lockfile failed: Invalid argument
> > messaging_dgm_init failed: Invalid argument
>
> Ah ok - I expected as much. snprintf seems to be
> broken in that it's returning -1.
>
> Is this our snprintf or one from Solaris ? Can
> you try and track down why it's returning -1 ?
According to the Linux man pages, snprintf shouldn't
return -1. However:
The glibc implementation of the functions snprintf() and vsnprintf()
conforms to the C99 standard, that is, behaves as described above,
since glibc version 2.1. Until glibc 2.0.6 they would return -1 when
the output was truncated.
More information about the samba
mailing list