diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-08-16 00:32:41 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-08-16 00:32:41 +0000 |
commit | 90adec6981753547df5673d086666eaa720d0ab6 (patch) | |
tree | 04c62c68d24d75eafda44f65f041aaf38892bb15 /kdm/kfrontend/kdmctl.c | |
parent | d54ab5595153b3dc57560077ff3551ffd4406b30 (diff) | |
download | tdebase-90adec6981753547df5673d086666eaa720d0ab6.tar.gz tdebase-90adec6981753547df5673d086666eaa720d0ab6.zip |
Make kdmctl reliable
Backport of KDE4 SVN revision 1196803
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1247445 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdm/kfrontend/kdmctl.c')
-rw-r--r-- | kdm/kfrontend/kdmctl.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/kdm/kfrontend/kdmctl.c b/kdm/kfrontend/kdmctl.c index 72e133162..7f70a4ddc 100644 --- a/kdm/kfrontend/kdmctl.c +++ b/kdm/kfrontend/kdmctl.c @@ -93,15 +93,13 @@ exe( int fd, const char *in, int len ) fprintf( stderr, "Cannot send command\n" ); return 1; } - if ((len = read( fd, buf, sizeof(buf) )) <= 0) { - fprintf( stderr, "Cannot receive reply\n" ); - return 1; - } - if (len == sizeof(buf) && buf[sizeof(buf) - 1] != '\n') - fprintf( stderr, "Warning: reply is too long\n" ); - fwrite( buf, 1, len, stdout ); - if (len == sizeof(buf) && buf[sizeof(buf) - 1] != '\n') - puts( "[...]" ); + do { + if ((len = read(fd, buf, sizeof(buf))) <= 0) { + fprintf(stderr, "Cannot receive reply\n"); + return 1; + } + fwrite(buf, 1, len, stdout); + } while (buf[len - 1] != '\n'); return 0; } |