summaryrefslogtreecommitdiff
path: root/rpmio/rpmfileutil.h
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2007-11-22 16:28:30 +0200
committerPanu Matilainen <pmatilai@redhat.com>2007-11-22 16:28:30 +0200
commitd10acc7c2a280bd8e0aea3610d9a8767521a5f40 (patch)
treef7aeffa417332f6d81021aef3b2db26ff05174d2 /rpmio/rpmfileutil.h
parentd8cd2b6b1139a81b819e66817e22d814fe25a9e7 (diff)
downloadlibrpm-tizen-d10acc7c2a280bd8e0aea3610d9a8767521a5f40.tar.gz
librpm-tizen-d10acc7c2a280bd8e0aea3610d9a8767521a5f40.tar.bz2
librpm-tizen-d10acc7c2a280bd8e0aea3610d9a8767521a5f40.zip
Move makeTempFile() from misc.h to rpmfileutil.h
- probably not very useful outside rpm but used all over the tree, - rename to rpmMkTempFile() for namespacing since we're exporting it now
Diffstat (limited to 'rpmio/rpmfileutil.h')
-rw-r--r--rpmio/rpmfileutil.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/rpmio/rpmfileutil.h b/rpmio/rpmfileutil.h
index b2f72f518..0022e5d03 100644
--- a/rpmio/rpmfileutil.h
+++ b/rpmio/rpmfileutil.h
@@ -15,4 +15,20 @@
int rpmDoDigest(pgpHashAlgo algo, const char * fn,int asAscii,
unsigned char * digest, size_t * fsizep);
+
+/**
+ * Return file handle for a temporaray file.
+ * A unique temporaray file path will be generated using
+ * rpmGenPath(prefix, "%{_tmppath}/", "rpm-tmp.XXXXX")
+ * where "XXXXXX" is filled in using rand(3). The file is opened, and
+ * the link count and (dev,ino) location are verified after opening.
+ * The file name and the open file handle are returned.
+ *
+ * @param prefix leading part of temp file path
+ * @retval fnptr temp file name (or NULL)
+ * @retval fdptr temp file handle
+ * @return 0 on success
+ */
+int rpmMkTempFile(const char * prefix, const char ** fnptr, FD_t * fdptr);
+
#endif /* _RPMFILEUTIL_H */