Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes for 3.3.8 #411

Merged
merged 3 commits into from
Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}