You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
+ see <http://www.gnu.org/licenses/>. */
/* March 11, 2002 Manuel Novoa III
*
for use with mk[s]temp. Will fail (-1) if DIR is non-null and
doesn't exist, none of the searched dirs exists, or there's not
enough space in TMPL. */
-int attribute_hidden ___path_search (char *tmpl, size_t tmpl_len, const char *dir,
+int ___path_search (char *tmpl, size_t tmpl_len, const char *dir,
const char *pfx /*, int try_tmpdir*/)
{
/*const char *d; */
- size_t dlen, plen;
+ /* dir and pfx lengths should always fit into an int,
+ so don't bother using size_t here. Especially since
+ the printf func requires an int for precision (%*s). */
+ int dlen, plen;
if (!pfx || !pfx[0])
{
dlen--; /* remove trailing slashes */
/* check we have room for "${dir}/${pfx}XXXXXX\0" */
- if (tmpl_len < dlen + 1 + plen + 6 + 1)
+ if (tmpl_len < (size_t)dlen + 1 + plen + 6 + 1)
{
__set_errno (EINVAL);
return -1;
__GT_DIR: create a directory with given mode.
*/
-int __gen_tempname (char *tmpl, int kind, mode_t mode)
+int attribute_hidden __gen_tempname (char *tmpl, int kind, int flags, mode_t mode)
{
char *XXXXXX;
unsigned int i;
}
for (i = 0; i < TMP_MAX; ++i) {
- int j;
+ unsigned char j;
/* Get some random data. */
if (fillrand(randomness, sizeof(randomness)) != sizeof(randomness)) {
/* if random device nodes failed us, lets use the braindamaged ver */
fd = 0;
}
case __GT_FILE:
- fd = open (tmpl, O_RDWR | O_CREAT | O_EXCL, mode);
+ fd = open (tmpl, O_RDWR | O_CREAT | O_EXCL | flags, mode);
break;
#if defined __UCLIBC_HAS_LFS__
case __GT_BIGFILE:
- fd = open64 (tmpl, O_RDWR | O_CREAT | O_EXCL, mode);
+ fd = open64 (tmpl, O_RDWR | O_CREAT | O_EXCL | flags, mode);
break;
#endif
case __GT_DIR: