Skip to content

Commit

Permalink
add new options to help.
Browse files Browse the repository at this point in the history
Change-Id: Idccdf856b9c5fa1e7fd0e72ad0f7290522464a7f
(cherry picked from commit bc7fb5e)
  • Loading branch information
Priyesh Padmavilasom committed Nov 6, 2016
1 parent 0f2dde4 commit 191c336
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 49 deletions.
6 changes: 1 addition & 5 deletions client/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ TDNFIsInitialized(
return dwError;

error:
if(pnInitialized)
{
*pnInitialized = 0;
}
goto cleanup;
}

Expand Down Expand Up @@ -1079,7 +1075,7 @@ TDNFUpdateInfo(
pLocalTime = localtime(&dwUpdated);
if(!pLocalTime)
{
dwError = errno;
dwError = ERROR_TDNF_INVALID_PARAMETER;
BAIL_ON_TDNF_SYSTEM_ERROR(dwError);
}
memset(szDate, 0, DATELEN);
Expand Down
20 changes: 6 additions & 14 deletions client/repo.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,21 +103,13 @@ TDNFInitRepo(
}
else
{
//Look for the repo root cache dir. If not there,
//try to create and download into it.
if(access(pszRepoCacheDir, F_OK))
if(mkdir(pszRepoCacheDir, 755))
{
if(errno != ENOENT)
{
dwError = errno;
}
BAIL_ON_TDNF_SYSTEM_ERROR(dwError);

if(mkdir(pszRepoCacheDir, 755))
{
dwError = errno;
BAIL_ON_TDNF_SYSTEM_ERROR(dwError);
}
if(errno != EEXIST)
{
dwError = errno;
BAIL_ON_TDNF_SYSTEM_ERROR(dwError);
}
}

lr_handle_setopt(hLibRepo, NULL, LRO_URLS, ppszRepoUrls);
Expand Down
7 changes: 5 additions & 2 deletions client/rpmtrans.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,10 @@ TDNFRunTransaction(
return dwError;

error:
doCheck(pTS);
if(pTS)
{
doCheck(pTS);
}
goto cleanup;
}

Expand Down Expand Up @@ -750,7 +753,7 @@ TDNFRemoveCachedRpms(
for(dwIndex = 0; dwIndex < pCachedRpmsArray->len; ++dwIndex)
{
pszCachedRpm = g_array_index(pCachedRpmsArray, char*, dwIndex);
if(access(pszCachedRpm, F_OK) != -1)
if(IsNullOrEmptyString(pszCachedRpm))
{
if(unlink(pszCachedRpm))
{
Expand Down
39 changes: 12 additions & 27 deletions client/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,9 @@ TDNFUtilsMakeDir(
BAIL_ON_TDNF_ERROR(dwError);
}

if(access(pszDir, F_OK))
if(mkdir(pszDir, 755))
{
if(errno != ENOENT)
{
dwError = errno;
}
BAIL_ON_TDNF_SYSTEM_ERROR(dwError);

if(mkdir(pszDir, 755))
if(errno != EEXIST)
{
dwError = errno;
BAIL_ON_TDNF_SYSTEM_ERROR(dwError);
Expand Down Expand Up @@ -324,40 +318,31 @@ TDNFTouchFile(
BAIL_ON_TDNF_ERROR(dwError);
}

if(stat(pszFile, &st) == -1)
fd = creat(pszFile, S_IRUSR | S_IRGRP | S_IROTH);
if(fd == -1)
{
if(errno == ENOENT)
if(errno == EEXIST)
{
fd = creat(pszFile,
S_IRUSR | S_IRGRP | S_IROTH);
if(fd == -1)
times.actime = st.st_atime;
times.modtime = time(NULL);
if(utime(pszFile, &times))
{
dwError = errno;
BAIL_ON_TDNF_SYSTEM_ERROR(dwError);
}
else
{
close(fd);
}
}
else
{
dwError = errno;
BAIL_ON_TDNF_SYSTEM_ERROR(dwError);
}
}
else
{
times.actime = st.st_atime;
times.modtime = time(NULL);
if(utime(pszFile, &times))
{
dwError = errno;
BAIL_ON_TDNF_SYSTEM_ERROR(dwError);
}
}

cleanup:
if(fd != -1)
{
close(fd);
}
return dwError;

error:
Expand Down
5 changes: 4 additions & 1 deletion tools/cli/help.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,14 @@ TDNFCliShowHelp(

printf("options [-c [config file]]\n");
printf(" [--debugsolver]\n");
printf(" [--disablerepo=<repoid>]\n");
printf(" [--enablerepo=<repoid>]\n");
printf(" [--rpmverbosity [debug level name]] [-v] [-y] [--assumeno]\n");
printf(" [--version] [--installroot [path]]\n");
printf(" [--nogpgcheck]\n");
printf(" [-q, --quiet]\n");
printf(" [--releasever RELEASEVER] [--setopt SETOPTS]\n");
printf(" [--refresh] [-4] [-6] [-h]\n");
printf(" [--refresh]\n");

printf("List of Main Commands\n");
printf("\n");
Expand Down

0 comments on commit 191c336

Please sign in to comment.