]> rtime.felk.cvut.cz Git - l4.git/blobdiff - l4/pkg/uclibc/lib/contrib/uclibc/libc/misc/internals/tempname.c
update
[l4.git] / l4 / pkg / uclibc / lib / contrib / uclibc / libc / misc / internals / tempname.c
index cbd4ced7a141dd5eb1abad89a6a8c64b80a9a791..4145c947830f9c4c4970ed9e0557160e52483c5c 100644 (file)
@@ -168,14 +168,14 @@ static void brain_damaged_fillrand(unsigned char *buf, unsigned int len)
 
    KIND may be one of:
    __GT_NOCREATE:       simply verify that the name does not exist
-                        at the time of the call.
+                        at the time of the call. mode argument is ignored.
    __GT_FILE:           create the file using open(O_CREAT|O_EXCL)
-                        and return a read-write fd.  The file is mode 0600.
+                        and return a read-write fd with given mode.
    __GT_BIGFILE:        same as __GT_FILE but use open64().
-   __GT_DIR:            create a directory, which will be mode 0700.
+   __GT_DIR:            create a directory with given mode.
 
 */
-int attribute_hidden __gen_tempname (char *tmpl, int kind)
+int __gen_tempname (char *tmpl, int kind, mode_t mode)
 {
     char *XXXXXX;
     unsigned int i;
@@ -217,15 +217,15 @@ int attribute_hidden __gen_tempname (char *tmpl, int kind)
                        fd = 0;
                }
            case __GT_FILE:
-               fd = open (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
+               fd = open (tmpl, O_RDWR | O_CREAT | O_EXCL, mode);
                break;
 #if defined __UCLIBC_HAS_LFS__
            case __GT_BIGFILE:
-               fd = open64 (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
+               fd = open64 (tmpl, O_RDWR | O_CREAT | O_EXCL, mode);
                break;
 #endif
            case __GT_DIR:
-               fd = mkdir (tmpl, S_IRUSR | S_IWUSR | S_IXUSR);
+               fd = mkdir (tmpl, mode);
                break;
            default:
                fd = -1;