You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by stefan novak <lm...@gmail.com> on 2011/10/05 09:41:27 UTC

PATCH mod_fcgid compile fails

Hello!

When you want to compile mod_fcgid als build in static module it fails with:

modules/fcgid/.libs/libmod_fcgid.a(fcgid_mutex_unix.o): In function
`fcgid_mutex_create':
fcgid_mutex_unix.c:(.text+0x65): warning: the use of `tmpnam' is dangerous,
better use `mkstemp'
make[1]: Leaving directory `/root/rpmbuild/SOURCES/httpd-2.2.21'

The following patch helps, but i dont know if its the right solution.

1129#centos6-build:diff modules/fcgid/fcgid_mutex_unix.c
../mod_fcgid-2.3.6/modules/fcgid/fcgid_mutex_unix.c
118c118
<     mkstemp(lockfile);
---
>     tmpnam(lockfile);

Can someone check it?

thx
Stefan Novak

Re: PATCH mod_fcgid compile fails

Posted by stefan novak <lm...@gmail.com>.
sorry for my noise.
just cleaned up my build tree and tried from the beginning. no more compile
errors.

thx for your help
Stefan

Re: PATCH mod_fcgid compile fails

Posted by Lazy <la...@gmail.com>.
2011/10/5 stefan novak <lm...@gmail.com>:
>> this is only a warning, are You sure httpd fails to build ?
>
> yes, httpd fails to build with this lines :(
> maybe another compile flag will help, i'm not sure...

i ran similar test on my system without problems (only this warning)
# ./configure --enable-fcgid
# make
...
/usr/share/apr-1.0/build/libtool --silent --mode=link
i486-linux-gnu-gcc -pthread        -o httpd  modules.lo buildmark.o
-export-dynamic server/libmain.la modules/aaa/libmod_authn_file.la
modules/aaa/libmod_authn_default.la modules/aaa/libmod_authz_host.la
modules/aaa/libmod_authz_groupfile.la modules/aaa/libmod_authz_user.la
modules/aaa/libmod_authz_default.la modules/aaa/libmod_auth_basic.la
modules/fcgid/libmod_fcgid.la modules/filters/libmod_include.la
modules/filters/libmod_filter.la modules/loggers/libmod_log_config.la
modules/metadata/libmod_env.la modules/metadata/libmod_setenvif.la
modules/metadata/libmod_version.la modules/http/libmod_http.la
modules/http/libmod_mime.la modules/generators/libmod_status.la
modules/generators/libmod_autoindex.la
modules/generators/libmod_asis.la modules/generators/libmod_cgi.la
modules/mappers/libmod_negotiation.la modules/mappers/libmod_dir.la
modules/mappers/libmod_actions.la modules/mappers/libmod_userdir.la
modules/mappers/libmod_alias.la modules/mappers/libmod_so.la
server/mpm/prefork/libprefork.la os/unix/libos.la -lm
/usr/src/test_ap/httpd-2.2.21/srclib/pcre/libpcre.la
/usr/lib/libaprutil-1.la /usr/lib/libapr-1.la -luuid -lrt -lcrypt
-lpthread -ldl
modules/fcgid/.libs/libmod_fcgid.a(fcgid_mutex_unix.o): In function
`fcgid_mutex_create':
fcgid_mutex_unix.c:(.text+0x47): warning: the use of `tmpnam' is
dangerous, better use `mkstemp'
make[1]: Opuszczenie katalogu `/obr/src/test_ap/httpd-2.2.21'

# ./httpd -l|grep fcgid
  mod_fcgid.c

so httpd biulds correctly

if it still fails for you please paste more make logs and your configure options

-- 
Michal Grzedzicki

Re: PATCH mod_fcgid compile fails

Posted by stefan novak <lm...@gmail.com>.
>
> this is only a warning, are You sure httpd fails to build ?
>

yes, httpd fails to build with this lines :(
maybe another compile flag will help, i'm not sure...


>
> > The following patch helps, but i dont know if its the right solution.
> > 1129#centos6-build:diff modules/fcgid/fcgid_mutex_unix.c
> > ../mod_fcgid-2.3.6/modules/fcgid/fcgid_mutex_unix.c
> > 118c118
> > <     mkstemp(lockfile);
> > ---
> >>     tmpnam(lockfile);
> > Can someone check it?
>
> I think this won't work
>
> from man
>
> The  mkstemp()  function generates a unique temporary filename from
> template, creates and opens the file, and returns an open file
> descriptor for the file.
>
> The  tmpnam() function returns a pointer to a string that is a valid
> filename, and such that a file with this name did not exist at some
> point in time
>
> tmpnam() creates a temporary filename in lockfile which is used by
> apr_global_mutex_create()
>
> mkstemp() won't touch lockfile so apr_global_mutex_create() will get
> always same empty string, i think this might work on some platforms
> where default lock mechanism doesn't need a filename
>
>
sounds not so good.
is anyone able to produce a better patch, i'm not a C programer :(

thx S.Novak

Re: PATCH mod_fcgid compile fails

Posted by Lazy <la...@gmail.com>.
2011/10/5 stefan novak <lm...@gmail.com>:
> Hello!
> When you want to compile mod_fcgid als build in static module it fails with:
> modules/fcgid/.libs/libmod_fcgid.a(fcgid_mutex_unix.o): In function
> `fcgid_mutex_create':
> fcgid_mutex_unix.c:(.text+0x65): warning: the use of `tmpnam' is dangerous,
> better use `mkstemp'
> make[1]: Leaving directory `/root/rpmbuild/SOURCES/httpd-2.2.21'

this is only a warning, are You sure httpd fails to build ?

> The following patch helps, but i dont know if its the right solution.
> 1129#centos6-build:diff modules/fcgid/fcgid_mutex_unix.c
> ../mod_fcgid-2.3.6/modules/fcgid/fcgid_mutex_unix.c
> 118c118
> <     mkstemp(lockfile);
> ---
>>     tmpnam(lockfile);
> Can someone check it?

I think this won't work

from man

The  mkstemp()  function generates a unique temporary filename from
template, creates and opens the file, and returns an open file
descriptor for the file.

The  tmpnam() function returns a pointer to a string that is a valid
filename, and such that a file with this name did not exist at some
point in time

tmpnam() creates a temporary filename in lockfile which is used by
apr_global_mutex_create()

mkstemp() won't touch lockfile so apr_global_mutex_create() will get
always same empty string, i think this might work on some platforms
where default lock mechanism doesn't need a filename

-- 
Michal Grzedzicki