Browse Source

Added /tmp cleanup from Fernando

git-svn-id: svn+ssh://jackaudio.org/trunk/jack@417 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/0.109.0
trutkin 22 years ago
parent
commit
d42a874de0
2 changed files with 36 additions and 1 deletions
  1. +1
    -1
      configure.in
  2. +35
    -0
      libjack/shm.c

+ 1
- 1
configure.in View File

@@ -14,7 +14,7 @@ dnl changes are made
dnl --- dnl ---
JACK_MAJOR_VERSION=0 JACK_MAJOR_VERSION=0
JACK_MINOR_VERSION=72 JACK_MINOR_VERSION=72
JACK_MICRO_VERSION=2
JACK_MICRO_VERSION=3


dnl --- dnl ---
dnl HOWTO: updating the jack protocal version dnl HOWTO: updating the jack protocal version


+ 35
- 0
libjack/shm.c View File

@@ -27,6 +27,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/types.h> #include <sys/types.h>
#include <dirent.h>
#include <sys/ipc.h> #include <sys/ipc.h>
#include <sys/shm.h> #include <sys/shm.h>
#include <config.h> #include <config.h>
@@ -105,11 +106,45 @@ jack_initialize_shm ()
void void
jack_cleanup_shm () jack_cleanup_shm ()
{ {
#if ! USE_POSIX_SHM
char path[PATH_MAX+1];
DIR *dir;
struct dirent *dirent;
#endif
int i; int i;


for (i = 0; i < jack_shm_id_cnt; i++) { for (i = 0; i < jack_shm_id_cnt; i++) {
jack_destroy_shm (jack_shm_registry[i].name); jack_destroy_shm (jack_shm_registry[i].name);
} }
#if ! USE_POSIX_SHM

snprintf (path, sizeof(path), "%s/jack/shm", jack_server_dir);
if ((dir = opendir (path)) == NULL) {
if (errno != ENOENT) {
jack_error ("cannot open jack shm directory (%s)", strerror (errno));
}
} else {
while ((dirent = readdir (dir)) != NULL) {
char fullpath[PATH_MAX+1];
snprintf (fullpath, sizeof (fullpath), "%s/jack/shm/%s", jack_server_dir, dirent->d_name);
unlink (fullpath);
}
}
closedir (dir);

snprintf (path, sizeof(path), "%s/jack/shm", jack_server_dir);
if (rmdir (path)) {
if (errno != ENOENT) {
jack_error ("cannot remove JACK shm directory (%s)", strerror (errno));
}
}
snprintf (path, sizeof(path), "%s/jack", jack_server_dir);
if (rmdir (path)) {
if (errno != ENOENT) {
jack_error ("cannot remove JACK directory (%s)", strerror (errno));
}
}
#endif
} }


#if USE_POSIX_SHM #if USE_POSIX_SHM


Loading…
Cancel
Save