On Friday 01 May 2009 06:55:22 Mikhail Gusarov wrote: > +++ b/sys-utils/chname.c > > + * © 2009 Mikhail Gusarov <dottedmag@xxxxxxxxxxxxx> should use "Copyright" rather than the symbol since the latter can easily be corrupted via random charset conversions. yes, there are other places which would cause problems (umlauts in names), but we should avoid the issue altogether when the usage is completely spurious. > +#include <stdio.h> > +#include <stdlib.h> > +#include <unistd.h> > +#include <string.h> > +#include <errno.h> > + > +/* For unshare() and CLONE_NEWUTS */ > +#define _USE_MISC > +#include <sched.h> the _USE_XXX really need to come before any other include, especially with glibc. however, rather than go down this rat hole, just add AC_USE_SYSTEM_EXTENSIONS to configure.ac and be done. > +int main(int argc, char **argv) > +{ > + const char *prgname = argv[0]; most other utils are using program_invocation_short_name, so you might as well too > + if (unshare(CLONE_NEWUTS)) { this isnt dependent upon kernel version, but rather the C library. as such, a configure test for the unshare() function should be added and if it doesnt exist, either dont build the utility or have it error out with a simple "sorry, your C library is too old". -mike
Attachment:
signature.asc
Description: This is a digitally signed message part.