Skip to content

Commit

Permalink
Merge pull request #411 from oliverkurth/stable-3.3
Browse files Browse the repository at this point in the history
fixes for 3.3.8
  • Loading branch information
oliverkurth authored Mar 14, 2023
2 parents ff9cd5f + 5d23188 commit 8463aa4
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

CMAKE_MINIMUM_REQUIRED(VERSION 3.0 FATAL_ERROR)

project(tdnf VERSION 3.3.7 LANGUAGES C)
project(tdnf VERSION 3.3.8 LANGUAGES C)
set(VERSION ${PROJECT_VERSION})
set(PROJECT_YEAR 2023)

Expand Down
6 changes: 0 additions & 6 deletions client/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@

#include "config.h"

/*
* creating this under /var/run because /var/run/lock doesn't exist
* in fedora docker images and as a result ci fails
*/
#define TDNF_INSTANCE_LOCK_FILE "/var/run/.tdnf-instance-lockfile"

typedef enum
{
/* this should be a bitmask */
Expand Down
2 changes: 1 addition & 1 deletion client/repolist.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ TDNFLoadReposFromFile(
dwError = TDNFReadKeyValue(
pSections,
TDNF_REPO_KEY_NAME,
NULL,
pszRepo,
&pRepo->pszName);
BAIL_ON_TDNF_ERROR(dwError);

Expand Down
6 changes: 6 additions & 0 deletions common/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,9 @@
} while(0)

#define TDNF_DEFAULT_MAX_STRING_LEN 16384000

/*
* creating this under /var/run because /var/run/lock doesn't exist
* in fedora docker images and as a result ci fails
*/
#define TDNF_INSTANCE_LOCK_FILE "/var/run/.tdnf-instance-lockfile"
21 changes: 21 additions & 0 deletions common/lock.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,21 @@ static tdnflock tdnflock_new(const char *lock_path, const char *descr)
else
{
lock->openmode = TDNFLOCK_WRITE | TDNFLOCK_READ;

/* Write out PID into lock file */
char pid_buffer[128] = {0};
int rsnpf;
rsnpf = snprintf(pid_buffer, sizeof(pid_buffer), "%ld\n", (long) getpid());

if (rsnpf > 0)
{
int wr;
wr = write(lock->fd, pid_buffer, strlen(pid_buffer));
if (wr == 0)
{
sync();
}
}
}

lock->fdrefs = 1;
Expand Down Expand Up @@ -236,5 +251,11 @@ tdnflock tdnflockFree(tdnflock lock)
tdnflock_free(lock);
}

if (remove(TDNF_INSTANCE_LOCK_FILE))
{
pr_err("WARNING: Unable to remove lockfile(%s)\n",
TDNF_INSTANCE_LOCK_FILE);
}

return NULL;
}

0 comments on commit 8463aa4

Please sign in to comment.