summaryrefslogtreecommitdiffstats
path: root/utils/update-alternatives.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-07 13:30:08 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-07 13:30:08 +0000
commit44cf9c6d2d274eac37502e835155f7e985f1b8e6 (patch)
tree9576ba968924c5b9a55ba9e14f4f26184c62c7d4 /utils/update-alternatives.c
parentAdding upstream version 1.22.6. (diff)
downloaddpkg-44cf9c6d2d274eac37502e835155f7e985f1b8e6.tar.xz
dpkg-44cf9c6d2d274eac37502e835155f7e985f1b8e6.zip
Adding upstream version 1.22.7.upstream/1.22.7
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'utils/update-alternatives.c')
-rw-r--r--utils/update-alternatives.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index 7d21a4d..9909cde 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -380,7 +380,7 @@ areadlink(const char *linkname)
/* Read it and terminate the string properly */
size = readlink(linkname, buf, st.st_size);
- if (size == -1) {
+ if (size < 0) {
int saved_errno = errno;
free(buf);
@@ -400,13 +400,13 @@ spawn(const char *prog, const char *args[])
int status;
pid = fork();
- if (pid == -1)
+ if (pid < 0)
error(_("fork failed"));
if (pid == 0) {
execvp(prog, (char *const *)args);
syserr(_("unable to execute %s (%s)"), prog, prog);
}
- while ((dead_pid = waitpid(pid, &status, 0)) == -1 && errno == EINTR) ;
+ while ((dead_pid = waitpid(pid, &status, 0)) < 0 && errno == EINTR) ;
if (dead_pid != pid)
error(_("wait for subprocess %s failed"), prog);
@@ -1530,7 +1530,7 @@ alternative_load(struct alternative *a, enum altdb_flags flags)
}
/* Verify the alternative is not empty. */
- if (fstat(fileno(ctx.fh), &st) == -1)
+ if (fstat(fileno(ctx.fh), &st) < 0)
syserr(_("cannot stat file '%s'"), ctx.filename);
if (st.st_size == 0) {
altdb_context_free(&ctx);
@@ -1958,7 +1958,7 @@ alternative_path_classify(const char *linkname)
{
struct stat st;
- if (fsys_lstat(linkname, &st) == -1) {
+ if (fsys_lstat(linkname, &st) < 0) {
if (errno != ENOENT)
syserr(_("cannot stat file '%s%s'"), instdir, linkname);
return ALT_PATH_MISSING;