summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1996-07-03 18:35:58 +0000
committerMiles Bader <miles@gnu.org>1996-07-03 18:35:58 +0000
commit38eae2b44ee0e71d7f36fdd9d34c5cfacbdf5184 (patch)
treed357841ea17968ad9f0c19286906665f25b10413
parent4ee58f8a7f53edd4d1990e43101c11f84554daa6 (diff)
(fstab_add_fs): Don't SEGV if COPY is 0.
-rw-r--r--sutils/fstab.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sutils/fstab.c b/sutils/fstab.c
index 5b8d17ca..6c8e0f81 100644
--- a/sutils/fstab.c
+++ b/sutils/fstab.c
@@ -484,16 +484,20 @@ error_t
fstab_add_fs (struct fstab *dst, struct fs *fs, struct fs **copy)
{
error_t err;
+ struct fs *new;
struct fstab *src = fs->fstab;
if (dst->types != src->types)
return EINVAL;
- err = fstab_add_mntent (dst, &fs->mntent, copy);
+ err = fstab_add_mntent (dst, &fs->mntent, &new);
if (err)
return err;
- (*copy)->type = fs->type;
+ new->type = fs->type;
+
+ if (copy)
+ *copy = new;
return 0;
}