summaryrefslogtreecommitdiffstats
path: root/linux
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2024-01-09 23:57:40 +0100
committerBenBE <BenBE@geshi.org>2024-01-10 09:44:36 +0100
commit2b6304cec56272f28a305a3099bdb5f996c829ce (patch)
tree5386edbc215528ad01d66955839a4ad31e41d70e /linux
parentf9fb93aaf8712934ee0c78d5d887882fd29b6e36 (diff)
Linux: use fseek(3)
Use fseek(3) instead of rewind(3) to check for success.
Diffstat (limited to 'linux')
-rw-r--r--linux/LinuxProcess.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/linux/LinuxProcess.c b/linux/LinuxProcess.c
index c2039796..dc4f2594 100644
--- a/linux/LinuxProcess.c
+++ b/linux/LinuxProcess.c
@@ -196,13 +196,10 @@ static bool LinuxProcess_changeAutogroupPriorityBy(Process* p, Arg delta) {
long int identity;
int nice;
int ok = fscanf(file, "/autogroup-%ld nice %d", &identity, &nice);
- bool success;
- if (ok == 2) {
- rewind(file);
+ bool success = false;
+ if (ok == 2 && fseek(file, 0L, SEEK_SET) == 0) {
xSnprintf(buffer, sizeof(buffer), "%d", nice + delta.i);
success = fputs(buffer, file) > 0;
- } else {
- success = false;
}
fclose(file);

© 2014-2024 Faster IT GmbH | imprint | privacy policy