Be more forgiving of PnP config saving failures.

This commit is contained in:
Jordan K. Hubbard 1999-02-16 01:58:04 +00:00
parent 6b4286e0f5
commit d207e2138a
2 changed files with 14 additions and 8 deletions

View file

@ -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;
}

View file

@ -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;
}