VirtualBox

Changeset 42712 in vbox for trunk/include/iprt/file.h


Ignore:
Timestamp:
Aug 9, 2012 2:36:02 PM (12 years ago)
Author:
vboxsync
Message:

Runtime: add RTFileCreateTemp, RTFileCreateTempSecure and RTDirCreateTempSecure (the last two are not yet implemented).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/file.h

    r39641 r42712  
    587587
    588588
     589/**
     590 * Creates a new file with a unique name using the given template.
     591 *
     592 * One or more trailing X'es in the template will be replaced by random alpha
     593 * numeric characters until a RTFileOpen with RTFILE_O_CREATE succeeds or we
     594 * run out of patience.
     595 * For instance:
     596 *          "/tmp/myprog-XXXXXX"
     597 *
     598 * As an alternative to trailing X'es, it is possible to put 3 or more X'es
     599 * somewhere inside the file name. In the following string only the last
     600 * bunch of X'es will be modified:
     601 *          "/tmp/myprog-XXX-XXX.tmp"
     602 *
     603 * @returns iprt status code.
     604 * @param   pszTemplate     The file name template on input. The actual file
     605 *                          name on success. Empty string on failure.
     606 * @param   fMode           The mode to create the file with.  Use 0600 unless
     607 *                          you have reason not to.
     608 */
     609RTDECL(int) RTFileCreateTemp(char *pszTemplate, RTFMODE fMode);
     610
     611/**
     612 * Secure version of @a RTFileCreateTemp with a fixed mode of 0600.
     613 *
     614 * This function behaves in the same way as @a RTFileCreateTemp with two
     615 * additional points.  Firstly the mode is fixed to 0600.  Secondly it will
     616 * fail if it is not possible to perform the operation securely.  Possible
     617 * reasons include that the file could be removed by another unprivileged
     618 * user before it is used (e.g. if is created in a non-sticky /tmp directory)
     619 * or that the path contains symbolic links which another unprivileged user
     620 * could manipulate; however the exact criteria will be specified on a
     621 * platform-by-platform basis as platform support is added.
     622 * @see RTPathIsSecure for the current list of criteria.
     623 * @returns iprt status code.
     624 * @returns VERR_NOT_SUPPORTED if the interface can not be supported on the
     625 *                             current platform at this time.
     626 * @returns VERR_INSECURE      if the file could not be created securely.
     627 * @param   pszTemplate        The file name template on input. The actual
     628 *                             file name on success. Empty string on failure.
     629 */
     630RTDECL(int) RTFileCreateTempSecure(char *pszTemplate);
     631
     632
    589633/** @page   pg_rt_filelock      RT File locking API description
    590634 *
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette