projects
/
u
/
mdw
/
catacomb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
More reliable copying in key saving.
[u/mdw/catacomb]
/
key-file.c
diff --git
a/key-file.c
b/key-file.c
index
15b0304
..
6e422b1
100644
(file)
--- a/
key-file.c
+++ b/
key-file.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id
: key-file.c,v 1.3 2004/04/08 01:36:15 mdw Exp
$
+ * $Id$
*
* System-dependent key filing operations
*
*
* System-dependent key filing operations
*
@@
-60,6
+60,7
@@
static int fdcopy(int source, int dest)
{
char buf[4096];
static int fdcopy(int source, int dest)
{
char buf[4096];
+ char *p;
if (lseek(source, 0, SEEK_SET) < 0||
lseek(dest, 0, SEEK_SET) < 0 ||
if (lseek(source, 0, SEEK_SET) < 0||
lseek(dest, 0, SEEK_SET) < 0 ||
@@
-71,8
+72,14
@@
static int fdcopy(int source, int dest)
return (-1);
else if (n == 0)
break;
return (-1);
else if (n == 0)
break;
- else if (write(dest, buf, n) < 0)
- return (-1);
+ p = buf;
+ while (n) {
+ int nn = write(dest, p, n);
+ if (nn < 0)
+ return (-1);
+ p += nn;
+ n -= nn;
+ }
}
return (0);
}
}
return (0);
}