Hi, On 06/01/2010 02:14 PM, Ales Kozumplik wrote:
--- loader/loader.c | 19 +++++++++++++++---- 1 files changed, 15 insertions(+), 4 deletions(-) diff --git a/loader/loader.c b/loader/loader.c index fbbd13b..59d5beb 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -1142,12 +1142,22 @@ static void parseCmdLineFlags(struct loaderData_s * loaderData, } /* make sure they have enough ram */ -static void checkForRam(void) { - if (totalMemory()< MIN_RAM) { +static void checkForRam(int install_method) { + char reason_no[] = ""; + char reason_method[] = " using this install method";
> + char *reason = reason_no; It would better to use: const char *reason_no = ""; const char *reason_method = " using this install method"; const char *reason = reason_no; When you write: char reason_method[] = " using this install method"; You are asking the compiler to create a const string " using this install method" in the constant segment, and to allocate an array on the stack large enough to hold this string, and upon entering of the function to copy the contents of the const string to the array on the stack. It would be better (more efficient) to just pass a pointer around. Other then this, ack.
+ int needed = MIN_RAM; + + if (install_method == METHOD_URL) { + needed += URL_INSTALL_EXTRA_RAM; + reason = reason_method; + } + + if (totalMemory()< needed) { char *buf; checked_asprintf(&buf, _("You do not have enough RAM to install %s " - "on this machine."), getProductName()); + "on this machine%s."), getProductName(), reason); startNewt(); newtWinMessage(_("Error"), _("OK"), buf); @@ -1535,6 +1545,7 @@ static char *doLoaderMain(struct loaderData_s *loaderData, } logMessage(INFO, "starting STEP_STAGE2"); + checkForRam(loaderData->method); url = installMethods[validMethods[loaderData->method]].mountImage( installMethods + validMethods[loaderData->method], "/mnt/stage2", loaderData); @@ -1949,7 +1960,7 @@ int main(int argc, char ** argv) { } initializeConsole(); - checkForRam(); + checkForRam(-1); /* iSeries vio console users will be ssh'ing in to the primary partition, so use a terminal type that is appripriate */
Regards, Hans _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list