diff options
Diffstat (limited to 'user')
-rw-r--r-- | user/tlecarrour.mdwn | 2 | ||||
-rw-r--r-- | user/tlecarrour/sakura.mdwn | 30 |
2 files changed, 27 insertions, 5 deletions
diff --git a/user/tlecarrour.mdwn b/user/tlecarrour.mdwn index 515dd855..4892f124 100644 --- a/user/tlecarrour.mdwn +++ b/user/tlecarrour.mdwn @@ -35,4 +35,4 @@ For each patch make sure to respect the [[patch life cycle|patch_life_cycle]]. * [[rng-tools]] (PATH_MAX), **discussing** * [[suckless-tools]] (PATH_MAX), **submitted** * [[up-imapproxy]] (PATH_MAX), **discussing** -* [[sakura]] (PATH_MAX), **discussing** +* [[sakura]] (PATH_MAX), **submitted** diff --git a/user/tlecarrour/sakura.mdwn b/user/tlecarrour/sakura.mdwn index 955247f1..d0cd8711 100644 --- a/user/tlecarrour/sakura.mdwn +++ b/user/tlecarrour/sakura.mdwn @@ -29,7 +29,7 @@ Log * **Started**: 2012-02-03 * **Discussed**: [2012-02-03](http://lists.debian.org/debian-hurd/2012/02/msg00031.html) * **Draft Submitted**: - -* **Submitted**: - +* **Submitted**: 2012-02-07, Bug#[659018](http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=659018) * **Accepted**: - @@ -41,7 +41,7 @@ ToDo Here is the output of `grep -R PATH_MAX sakura-2.4.2/*`: - src/sakura.c: char buf[PATH_MAX+1]; + src/sakura.c: char buf[PATH_MAX+1]; * * * @@ -50,6 +50,28 @@ Here is the output of `grep -R PATH_MAX sakura-2.4.2/*`: Comments -------- -work in progress... + + char *buf = NULL; + + struct stat sb; + +Will dynamically allocate the buffer according to information provided by `lstat()`. + + + if (lstat(file, &sb) == -1) { + + return cwd; + + } + + buf = malloc(sb.st_size + 1); + +Do the allocation. Don't bother to check for return value as `g_strdup_printf()` doesn't do it. + + + len = readlink (file, buf, sb.st_size + 1); + + + if (len < 0 || len > sb.st_size) { + + g_free(buf); + + return cwd; + + } + +Check `realink()` return value. + + + g_free(buf); + +Free the dynamically allocated buffer. -Buffer used with readlink(). |