aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-12-10 16:30:54 +0100
committerMattias Andrée <maandree@operamail.com>2014-12-10 16:30:54 +0100
commitcb29bbc8148468bbbea09031a85f0a4a5f8b1b1d (patch)
treee0a73c7fd05469a5828c484509e86b8f1dea0fa4 /src
parentmds-kbdc: fix memory exhaustion bug (diff)
downloadmds-cb29bbc8148468bbbea09031a85f0a4a5f8b1b1d.tar.gz
mds-cb29bbc8148468bbbea09031a85f0a4a5f8b1b1d.tar.bz2
mds-cb29bbc8148468bbbea09031a85f0a4a5f8b1b1d.tar.xz
m simplification
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/mds-kbdc/paths.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mds-kbdc/paths.c b/src/mds-kbdc/paths.c
index 7ef8af5..6ad39f1 100644
--- a/src/mds-kbdc/paths.c
+++ b/src/mds-kbdc/paths.c
@@ -33,7 +33,7 @@
*/
char* curpath(void)
{
- static size_t cwd_size = 4096 >> 1;
+ static size_t cwd_size = 4096;
char* cwd = NULL;
char* old = NULL;
int saved_errno;
@@ -42,13 +42,13 @@ char* curpath(void)
* but we will not assume that glibc is used here. */
for (;;)
{
- fail_if (xxrealloc(old, cwd, (cwd_size <<= 1) + 1, char));
+ fail_if (xxrealloc(old, cwd, cwd_size + 1, char));
if (getcwd(cwd, cwd_size))
break;
else
fail_if (errno != ERANGE);
+ cwd_size <<= 1;
}
- cwd_size >>= 1;
return cwd;
fail: