[pulseaudio-commits] r1974 - in /trunk/src/pulsecore: core-util.c core-util.h
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Mon Oct 29 08:31:25 PDT 2007
Author: lennart
Date: Mon Oct 29 16:31:24 2007
New Revision: 1974
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=1974&root=pulseaudio&view=rev
Log:
add new pa_readlink() API
Modified:
trunk/src/pulsecore/core-util.c
trunk/src/pulsecore/core-util.h
Modified: trunk/src/pulsecore/core-util.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/pulsecore/core-util.c?rev=1974&root=pulseaudio&r1=1973&r2=1974&view=diff
==============================================================================
--- trunk/src/pulsecore/core-util.c (original)
+++ trunk/src/pulsecore/core-util.c Mon Oct 29 16:31:24 2007
@@ -1507,3 +1507,27 @@
fds[0] = fds[1] = -1;
}
+
+char *pa_readlink(const char *p) {
+ size_t l = 100;
+
+ for (;;) {
+ char *c;
+ ssize_t n;
+
+ c = pa_xnew(char, l);
+
+ if ((n = readlink(p, c, l-1)) < 0) {
+ pa_xfree(c);
+ return NULL;
+ }
+
+ if (n < l-1) {
+ c[l-1] = 0;
+ return c;
+ }
+
+ pa_xfree(c);
+ l *= 2;
+ }
+}
Modified: trunk/src/pulsecore/core-util.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/pulsecore/core-util.h?rev=1974&root=pulseaudio&r1=1973&r2=1974&view=diff
==============================================================================
--- trunk/src/pulsecore/core-util.h (original)
+++ trunk/src/pulsecore/core-util.h Mon Oct 29 16:31:24 2007
@@ -122,4 +122,6 @@
void pa_close_pipe(int fds[2]);
+char *pa_readlink(const char *p);
+
#endif
More information about the pulseaudio-commits
mailing list