aboutsummaryrefslogtreecommitdiff
path: root/lib/libfigpar
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libfigpar')
-rw-r--r--lib/libfigpar/Makefile1
-rw-r--r--lib/libfigpar/figpar.c32
-rw-r--r--lib/libfigpar/string_m.c5
3 files changed, 13 insertions, 25 deletions
diff --git a/lib/libfigpar/Makefile b/lib/libfigpar/Makefile
index 350abdf7dfd3..66a1d61c7016 100644
--- a/lib/libfigpar/Makefile
+++ b/lib/libfigpar/Makefile
@@ -1,4 +1,3 @@
-
PACKAGE= dpv
LIB= figpar
SHLIB_MAJOR= 0
diff --git a/lib/libfigpar/figpar.c b/lib/libfigpar/figpar.c
index 642291ca7c6b..fbc6aaaba606 100644
--- a/lib/libfigpar/figpar.c
+++ b/lib/libfigpar/figpar.c
@@ -24,11 +24,9 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <sys/param.h>
#include <ctype.h>
-#include <errno.h>
#include <fcntl.h>
#include <fnmatch.h>
#include <stdlib.h>
@@ -162,11 +160,11 @@ parse_config(struct figpar_config options[], const char *path,
}
/* Get the current offset */
- curpos = lseek(fd, 0, SEEK_CUR) - 1;
- if (curpos == -1) {
+ if ((curpos = lseek(fd, 0, SEEK_CUR)) == -1) {
close(fd);
return (-1);
}
+ curpos--;
/* Find the length of the directive */
for (n = 0; r != 0; n++) {
@@ -188,8 +186,7 @@ parse_config(struct figpar_config options[], const char *path,
}
/* Go back to the beginning of the directive */
- error = (int)lseek(fd, curpos, SEEK_SET);
- if (error == (curpos - 1)) {
+ if (lseek(fd, curpos, SEEK_SET) == -1) {
close(fd);
return (-1);
}
@@ -247,11 +244,11 @@ parse_config(struct figpar_config options[], const char *path,
}
/* Get the current offset */
- curpos = lseek(fd, 0, SEEK_CUR) - 1;
- if (curpos == -1) {
+ if ((curpos = lseek(fd, 0, SEEK_CUR)) == -1) {
close(fd);
return (-1);
}
+ curpos--;
/* Find the end of the value */
quote = 0;
@@ -269,19 +266,18 @@ parse_config(struct figpar_config options[], const char *path,
*/
/* Get the current offset */
- charpos = lseek(fd, 0, SEEK_CUR) - 1;
- if (charpos == -1) {
+ if ((charpos = lseek(fd, 0, SEEK_CUR)) == -1) {
close(fd);
return (-1);
}
+ charpos--;
/*
* Go back so we can read the character before the key
* to check if the character is escaped (which means we
* should continue).
*/
- error = (int)lseek(fd, -2, SEEK_CUR);
- if (error == -3) {
+ if (lseek(fd, -2, SEEK_CUR) == -1) {
close(fd);
return (-1);
}
@@ -293,8 +289,7 @@ parse_config(struct figpar_config options[], const char *path,
*/
for (n = 1; *p == '\\'; n++) {
/* Move back another offset to read */
- error = (int)lseek(fd, -2, SEEK_CUR);
- if (error == -3) {
+ if (lseek(fd, -2, SEEK_CUR) == -1) {
close(fd);
return (-1);
}
@@ -302,8 +297,7 @@ parse_config(struct figpar_config options[], const char *path,
}
/* Move offset back to the key and read it */
- error = (int)lseek(fd, charpos, SEEK_SET);
- if (error == (charpos - 1)) {
+ if (lseek(fd, charpos, SEEK_SET) == -1) {
close(fd);
return (-1);
}
@@ -354,8 +348,7 @@ parse_config(struct figpar_config options[], const char *path,
}
/* Get the current offset */
- charpos = lseek(fd, 0, SEEK_CUR) - 1;
- if (charpos == -1) {
+ if ((charpos = lseek(fd, 0, SEEK_CUR)) == -1) {
close(fd);
return (-1);
}
@@ -366,8 +359,7 @@ parse_config(struct figpar_config options[], const char *path,
n--;
/* Move offset back to the beginning of the value */
- error = (int)lseek(fd, curpos, SEEK_SET);
- if (error == (curpos - 1)) {
+ if (lseek(fd, curpos, SEEK_SET) == -1) {
close(fd);
return (-1);
}
diff --git a/lib/libfigpar/string_m.c b/lib/libfigpar/string_m.c
index ce7948466543..df3def788971 100644
--- a/lib/libfigpar/string_m.c
+++ b/lib/libfigpar/string_m.c
@@ -24,12 +24,9 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
#include <ctype.h>
#include <errno.h>
-#include <stdio.h>
+#include <stdint.h>
#include <stdlib.h>
#include <string.h>