summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1999-02-16 01:58:04 +0000
committerjkh <jkh@FreeBSD.org>1999-02-16 01:58:04 +0000
commita90ae0fb61f0e918e3cafba8d21edfe5a29559b9 (patch)
treed4bdbbfa45d5bdb325564c07d16fd0e26d9c2015
parent08a4aed34d2e22f624880ea97ae63faabf7b2b11 (diff)
downloadFreeBSD-src-a90ae0fb61f0e918e3cafba8d21edfe5a29559b9.zip
FreeBSD-src-a90ae0fb61f0e918e3cafba8d21edfe5a29559b9.tar.gz
Be more forgiving of PnP config saving failures.
-rw-r--r--release/sysinstall/kget.c11
-rw-r--r--usr.sbin/sysinstall/kget.c11
2 files changed, 14 insertions, 8 deletions
diff --git a/release/sysinstall/kget.c b/release/sysinstall/kget.c
index d92a425..7dc207c 100644
--- a/release/sysinstall/kget.c
+++ b/release/sysinstall/kget.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: kget.c,v 1.1 1999/01/20 12:31:43 jkh Exp $
+ * $Id: kget.c,v 1.2 1999/02/15 07:07:37 jkh Exp $
*/
#include "sysinstall.h"
@@ -97,18 +97,18 @@ kget(char *out)
}
i += sizeof(struct isa_device) + 8;
}
- free(buf);
+ free(buf), buf = NULL;
/* Now, print the changes to PnP override table */
i = sysctlbyname(mib2, NULL, &len, NULL, NULL);
if (i) {
msgDebug("kget: error sizing buffer\n");
- return -1;
+ goto bail;
}
buf = (char *)malloc(len * sizeof(char));
i = sysctlbyname(mib2, buf, &len, NULL, NULL);
if (i) {
msgDebug("kget: error retrieving data\n");
- return -1;
+ goto bail;
}
i = 0;
/* Print the PnP override table. Taken from userconfig.c */
@@ -141,7 +141,10 @@ kget(char *out)
bytes_written += fprintf(fout,"\n");
}
} while ((i += sizeof(struct pnp_cinfo)) < len);
+bail:
fprintf(fout, "q\n");
fclose(fout);
+ if (buf)
+ free(buf);
return 0;
}
diff --git a/usr.sbin/sysinstall/kget.c b/usr.sbin/sysinstall/kget.c
index d92a425..7dc207c 100644
--- a/usr.sbin/sysinstall/kget.c
+++ b/usr.sbin/sysinstall/kget.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: kget.c,v 1.1 1999/01/20 12:31:43 jkh Exp $
+ * $Id: kget.c,v 1.2 1999/02/15 07:07:37 jkh Exp $
*/
#include "sysinstall.h"
@@ -97,18 +97,18 @@ kget(char *out)
}
i += sizeof(struct isa_device) + 8;
}
- free(buf);
+ free(buf), buf = NULL;
/* Now, print the changes to PnP override table */
i = sysctlbyname(mib2, NULL, &len, NULL, NULL);
if (i) {
msgDebug("kget: error sizing buffer\n");
- return -1;
+ goto bail;
}
buf = (char *)malloc(len * sizeof(char));
i = sysctlbyname(mib2, buf, &len, NULL, NULL);
if (i) {
msgDebug("kget: error retrieving data\n");
- return -1;
+ goto bail;
}
i = 0;
/* Print the PnP override table. Taken from userconfig.c */
@@ -141,7 +141,10 @@ kget(char *out)
bytes_written += fprintf(fout,"\n");
}
} while ((i += sizeof(struct pnp_cinfo)) < len);
+bail:
fprintf(fout, "q\n");
fclose(fout);
+ if (buf)
+ free(buf);
return 0;
}
OpenPOWER on IntegriCloud