Merge branch 'storageareas' of github.com:ConnorTechnology/ZoneMinder into storageareas

This commit is contained in:
Isaac Connor 2018-10-29 12:52:40 -04:00
commit 34d6ec40a1
2 changed files with 19 additions and 7 deletions

View File

@ -32,8 +32,8 @@
StreamBase::~StreamBase() {
#if HAVE_LIBAVCODEC
if ( vid_stream ) {
delete vid_stream;
vid_stream = NULL;
delete vid_stream;
vid_stream = NULL;
}
#endif
closeComms();
@ -286,6 +286,18 @@ void StreamBase::openComms() {
}
Debug(1, "Trying to open the lock on %s", sock_path_lock);
// Under systemd, we get chrooted to something like /tmp/systemd-apache-blh/ so the dir may not exist.
if ( mkdir(staticConfig.PATH_SOCKS.c_str(), 0755) ) {
if ( errno != EEXIST ) {
Error("Can't mkdir %s: %s", staticConfig.PATH_SOCKS.c_str(), strerror(errno));
return;
} else {
Error("EEXISTsuccess making dir %s", staticConfig.PATH_SOCKS.c_str() );
}
} else {
Error("success making dir %s", staticConfig.PATH_SOCKS.c_str() );
}
lock_fd = open(sock_path_lock, O_CREAT|O_WRONLY, S_IRUSR | S_IWUSR);
if ( lock_fd <= 0 ) {
Error("Unable to open sock lock file %s: %s", sock_path_lock, strerror(errno));
@ -301,8 +313,8 @@ void StreamBase::openComms() {
sd = socket(AF_UNIX, SOCK_DGRAM, 0);
if ( sd < 0 ) {
Fatal("Can't create socket: %s", strerror(errno));
} else {
Debug(1, "Have socket %d", sd);
} else {
Debug(3, "Have socket %d", sd);
}
length = snprintf(
@ -324,7 +336,7 @@ void StreamBase::openComms() {
strncpy(loc_addr.sun_path, loc_sock_path, sizeof(loc_addr.sun_path));
loc_addr.sun_family = AF_UNIX;
Debug(3, "Binding to %s", loc_sock_path);
Debug(3, "Binding to %s", loc_sock_path);
if ( bind(sd, (struct sockaddr *)&loc_addr, strlen(loc_addr.sun_path)+sizeof(loc_addr.sun_family)+1) < 0 ) {
Fatal("Can't bind: %s", strerror(errno));
}
@ -335,7 +347,7 @@ void StreamBase::openComms() {
gettimeofday(&last_comm_update, NULL);
} // end if connKey > 0
Debug(2, "comms open");
Debug(3, "comms open");
} // end void StreamBase::openComms()
void StreamBase::closeComms() {

@ -1 +1 @@
Subproject commit 0bd63fb464957080ead342db58ca9e01532cf1ef
Subproject commit c3976f1478c681b0bbc132ec3a3e82c3984eeed5