--- debianutils/mktemp.c.vorrudi 2012-04-22 03:33:23.000000000 +0200 +++ debianutils/mktemp.c 2012-06-24 16:49:13.000000000 +0200 @@ -85,15 +85,21 @@ } if (opts & OPT_u) { - /* Remove (up to) 6 X's */ - unsigned len = strlen(chp); - int cnt = len > 6 ? 6 : len; - while (--cnt >= 0 && chp[--len] == 'X') - chp[len] = '\0'; - - chp = tempnam(opts & (OPT_t|OPT_p) ? path : "./", chp); - if (!chp) + const char *pname = (opts & (OPT_t|OPT_p) ? path : "."); + unsigned len = strlen(chp)+strlen(pname)+1; + char *filename = (char *)malloc(len); + int ret=0; + snprintf(filename,len,"%s/%s",pname,chp); + chp=filename; + ret = mkstemp(filename); + if (ret<0) + { return EXIT_FAILURE; + } + else + { + close(ret); + } if (!(opts & (OPT_t|OPT_p))) chp += 2; goto ret;