aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/version.sh28
-rw-r--r--src/pcm.c6
2 files changed, 15 insertions, 19 deletions
diff --git a/scripts/version.sh b/scripts/version.sh
index 8876c40..9ed27a9 100755
--- a/scripts/version.sh
+++ b/scripts/version.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/sh
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
@@ -58,13 +58,13 @@ check_files()
# TINYALSA_VERSION_MAJOR
get_version_part()
{
- local V=$(grep -m 1 "^#define\([ \t]*\)$1" ${VERSION_FILE} | sed 's/[^0-9]*//g')
+ set -- "$1" "$(grep -m 1 "^#define\([ \t]*\)$1" ${VERSION_FILE} | sed 's/[^0-9]*//g')"
- if [ -z ${V} ]; then
+ if [ -z "$2" ]; then
die "Could not get $1 from ${VERSION_FILE}"
fi
- echo ${V}
+ echo "$2"
}
@@ -136,13 +136,7 @@ print_version()
bump_version()
{
- local PART="patch"
-
- if [ ! -z $1 ]; then
- PART="$1"
- fi
-
- case "$PART" in
+ case "${1:-patch}" in
major)
VERSION_MAJOR=$((VERSION_MAJOR+1))
VERSION_MINOR=0
@@ -170,14 +164,16 @@ bump_version()
check_version()
{
- local LOG_VERSION=$(grep -m 1 "^tinyalsa (" ${CHANGELOG_FILE}| sed "s/[^0-9.]*//g")
- local REF_VERSION="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"
+ # set $1 to log version, and $2 to ref version
+ set -- \
+ "$(grep -m 1 "^tinyalsa (" ${CHANGELOG_FILE}| sed "s/[^0-9.]*//g")" \
+ "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"
- if [ "${LOG_VERSION}" != "${REF_VERSION}" ]; then
- die "Changelog version (${LOG_VERSION}) does not match package version (${REF_VERSION})."
+ if [ "$1" != "$2" ]; then
+ die "Changelog version ($1) does not match package version ($2)."
fi
- printf "Changelog version (${LOG_VERSION}) OK!${LF}"
+ printf "Changelog version ($1) OK!${LF}"
return 0
}
diff --git a/src/pcm.c b/src/pcm.c
index 98c266c..ac82042 100644
--- a/src/pcm.c
+++ b/src/pcm.c
@@ -405,7 +405,7 @@ int pcm_set_config(struct pcm *pcm, const struct pcm_config *config)
if (pcm->flags & PCM_MMAP) {
pcm->mmap_buffer = mmap(NULL, pcm_frames_to_bytes(pcm, pcm->buffer_size),
- PROT_READ | PROT_WRITE, MAP_FILE | MAP_SHARED, pcm->fd, 0);
+ PROT_READ | PROT_WRITE, MAP_SHARED, pcm->fd, 0);
if (pcm->mmap_buffer == MAP_FAILED) {
int errno_copy = errno;
oops(pcm, errno, "failed to mmap buffer %d bytes\n",
@@ -544,7 +544,7 @@ static int pcm_hw_mmap_status(struct pcm *pcm)
return 0;
int page_size = sysconf(_SC_PAGE_SIZE);
- pcm->mmap_status = mmap(NULL, page_size, PROT_READ, MAP_FILE | MAP_SHARED,
+ pcm->mmap_status = mmap(NULL, page_size, PROT_READ, MAP_SHARED,
pcm->fd, SNDRV_PCM_MMAP_OFFSET_STATUS);
if (pcm->mmap_status == MAP_FAILED)
pcm->mmap_status = NULL;
@@ -552,7 +552,7 @@ static int pcm_hw_mmap_status(struct pcm *pcm)
goto mmap_error;
pcm->mmap_control = mmap(NULL, page_size, PROT_READ | PROT_WRITE,
- MAP_FILE | MAP_SHARED, pcm->fd, SNDRV_PCM_MMAP_OFFSET_CONTROL);
+ MAP_SHARED, pcm->fd, SNDRV_PCM_MMAP_OFFSET_CONTROL);
if (pcm->mmap_control == MAP_FAILED)
pcm->mmap_control = NULL;
if (!pcm->mmap_control) {