summaryrefslogtreecommitdiff
path: root/console-client
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2014-03-16 19:45:34 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2014-03-16 19:45:34 +0100
commita13a5288214c6dbb25bd8da04057f8ff17750ec1 (patch)
tree4ef40b2a92e9ae1b149f9a7a7ec86adcde3a8ce7 /console-client
parent8ad7f49e5b5e9a254f73de53941a58fc6032a737 (diff)
Fix crash on accessing vcs without a console being active
* console-client/current-vcs.c (vcs_readlink): Return error as negative values. (vcs_read): Convert errors returned by vcs_readlink before returning them.
Diffstat (limited to 'console-client')
-rw-r--r--console-client/current-vcs.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/console-client/current-vcs.c b/console-client/current-vcs.c
index e88e549d..f1112f98 100644
--- a/console-client/current-vcs.c
+++ b/console-client/current-vcs.c
@@ -57,7 +57,7 @@ vcs_readlink (struct iouser *user, struct node *np, char *buf)
ret = sprintf (buf, "%s/%d", cons_file, cur);
if (ret < 0)
- ret = errno;
+ ret = -errno;
}
return ret;
}
@@ -75,14 +75,14 @@ vcs_read (struct protid *user, char **data,
{
size = vcs_readlink (user->user, NULL, NULL);
if (size < 0)
- return size;
+ return -size;
buf = alloca (size);
err = vcs_readlink (user->user, NULL, buf);
if (err < 0)
- return err;
+ return -err;
if (offset + amount > size)
amount = size - offset;