summaryrefslogtreecommitdiffstats
path: root/tools/sendiso.c
diff options
context:
space:
mode:
authorGravatar Stefan Richter 2013-08-24 11:43:05 +0200
committerGravatar Stefan Richter 2013-08-24 11:51:11 +0200
commitba8d2119ba8be9189461d734d5bade32d7821e43 (patch)
tree009a598585bfe956d95ee2789f87257e1ab18f32 /tools/sendiso.c
parentDocumentation improvement: return code of raw1394_read_cycle_timer{,_and_clock} (diff)
tools: Fix startup of dumpiso and sendiso on juju
Quoting the errno manual: "[errno] is set by system calls and some library functions in the event of an error to indicate what went wrong. Its value is significant only when the return value of the call indicated an error (i.e., -1 from most system calls; -1 or NULL from most library functions); a function that succeeds is allowed to change errno. Valid error numbers are all nonzero; errno is never set to zero by any system call or library function." Dumpiso and sendiso checked for raw1394_set_port() failure by looking at errno rather than by looking at the function's return code. This happened to work on top of raw1394 by lucky incident but no longer works on top of firewire-core. Reported-by: Vladimir Romanov <blueboar2@gmail.com> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to '')
-rw-r--r--tools/sendiso.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/sendiso.c b/tools/sendiso.c
index 32ce4ce..6d23ab2 100644
--- a/tools/sendiso.c
+++ b/tools/sendiso.c
@@ -274,6 +274,7 @@ wrong_version:
int main(int argc, char **argv)
{
raw1394handle_t handle;
+ int ret;
parse_args(argc, argv);
@@ -296,10 +297,10 @@ int main(int argc, char **argv)
exit(1);
}
- raw1394_set_port(handle, which_port);
- } while (errno == ESTALE);
+ ret = raw1394_set_port(handle, which_port);
+ } while (ret < 0 && errno == ESTALE);
- if (errno) {
+ if (ret < 0) {
perror("raw1394_set_port");
exit(1);
}