Miscellanous fixes for Linux installer, including 53244, 107803, 122916, 122918.

r=sgehani, sr=dveditz
This commit is contained in:
syd%netscape.com 2002-02-07 03:44:26 +00:00
parent 20569a4c78
commit e393a46a8b
4 changed files with 57 additions and 28 deletions

View File

@ -37,7 +37,6 @@
#define MAX_URLS 32
#define MAX_URL_LEN 1024
#define MAX_DEPENDEE_KEY_LEN 16
#define MAX_TMP_DIRS 1024
#define MAX_LEGACY_CHECKS 32
@ -104,7 +103,6 @@
/*--------------------------------------------------------------------*
* Macros
*--------------------------------------------------------------------*/
#define TMP_DIR_TEMPLATE "/tmp/.tmp.xi.%d"
#define TMP_EXTRACT_SUBDIR "bin"
#define XPI_DIR "./xpi"

View File

@ -48,10 +48,9 @@ export MOZILLA_FIVE_HOME
BASEDIR=`dirname $0`
if [ "$BASEDIR" = "" ]; then
echo "dirname is not in your PATH"
./mozilla-installer-bin --sync $@
./mozilla-installer-bin $@
else
cd ${BASEDIR:-.}
./mozilla-installer-bin --sync $@
./mozilla-installer-bin $@
fi
rm -rf /tmp/.tmp.xi.*

View File

@ -786,9 +786,30 @@ nsSetupTypeDlg::CreateDestYes(GtkWidget *aWidget, gpointer aData)
{
DUMP("CreateDestYes");
int err = 0;
char path[PATH_MAX + 1];
int pathLen = strlen(gCtx->opt->mDestination);
if (pathLen > PATH_MAX)
pathLen = PATH_MAX;
memcpy(path, gCtx->opt->mDestination, pathLen);
path[pathLen] = '/'; // for uniform handling
struct stat buf;
mode_t oldPerms = umask(022);
err = mkdir(gCtx->opt->mDestination, (0777 & ~oldPerms));
for (int i = 1; !err && i <= pathLen; i++)
{
if (path[i] == '/')
{
path[i] = '\0';
if (stat(path, &buf) != 0)
{
err = mkdir(path, (0777 & ~oldPerms));
}
path[i] = '/';
}
}
umask(oldPerms); // restore original umask
gtk_widget_destroy(sCreateDestDlg);

View File

@ -43,6 +43,8 @@ nsXIEngine::nsXIEngine() :
{
}
#define RM_PREFIX "rm -rf "
nsXIEngine::~nsXIEngine()
{
DUMP("~nsXIEngine");
@ -50,7 +52,20 @@ nsXIEngine::~nsXIEngine()
// reset back to original directory
chdir(mOriginalDir);
XI_IF_FREE(mTmp);
if ( mTmp != (char *) NULL ) {
// blow away the temp dir
char *buf;
buf = (char *) malloc( strlen(RM_PREFIX) + strlen( mTmp ) + 1 );
if ( buf != (char *) NULL ) {
strcpy( buf, RM_PREFIX );
strcat( buf, mTmp );
system( buf );
XI_IF_FREE(mTmp);
free( buf );
}
}
XI_IF_FREE(mOriginalDir);
}
@ -406,7 +421,7 @@ nsXIEngine::CheckConn( char *URL, int type, CONN *myConn, PRBool force )
if ( myConn->type == TYPE_UNDEF )
retval = PR_TRUE; // first time
else if ( ( myConn->type != type || strcmp( URL, myConn->URL ) || force == PR_TRUE ) /* && gControls->state != ePaused */) {
else if ( ( myConn->type != type || myConn->URL == (char *) NULL || strcmp( URL, myConn->URL ) || force == PR_TRUE ) /* && gControls->state != ePaused */) {
retval = PR_TRUE;
switch ( myConn->type ) {
case TYPE_HTTP:
@ -416,14 +431,19 @@ nsXIEngine::CheckConn( char *URL, int type, CONN *myConn, PRBool force )
break;
case TYPE_FTP:
fconn = (nsFTPConn *) myConn->conn;
fconn->Close();
XI_IF_DELETE(fconn);
if ( fconn != (nsFTPConn *) NULL ) {
fconn->Close();
XI_IF_DELETE(fconn);
myConn->conn = NULL;
}
break;
}
}
if ( retval == PR_TRUE && myConn->URL != (char *) NULL )
if ( retval == PR_TRUE && myConn->URL != (char *) NULL ) {
free( myConn->URL );
myConn->URL = (char *) NULL;
}
return retval;
}
@ -528,25 +548,16 @@ nsXIEngine::Install(int aCustom, nsComponentList *aComps, char *aDestination)
int
nsXIEngine::MakeUniqueTmpDir()
{
int err = OK;
int i;
char buf[MAXPATHLEN];
struct stat dummy;
mTmp = NULL;
int err = E_DIR_CREATE;
for (i = 0; i < MAX_TMP_DIRS; i++)
{
sprintf(buf, TMP_DIR_TEMPLATE, i);
if (-1 == stat(buf, &dummy))
break;
mTmp = tempnam( (const char *) NULL, "xpi" );
if ( mTmp != (char *) NULL ) {
int tmperr;
tmperr = mkdir(mTmp, 0755);
if ( tmperr != -1 )
err = OK;
}
mTmp = (char *) malloc( (strlen(buf) * sizeof(char)) + 1 );
if (!mTmp) return E_MEM;
sprintf(mTmp, "%s", buf);
mkdir(mTmp, 0755);
return err;
}