[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 38/43: trans/mtab: Fix warnings.
From: |
Samuel Thibault |
Subject: |
[hurd] 38/43: trans/mtab: Fix warnings. |
Date: |
Mon, 11 Sep 2017 07:10:12 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit 812117cfbd76fadfd6c20913db665619070c170e
Author: Justus Winter <address@hidden>
Date: Wed Aug 30 13:10:48 2017 +0200
trans/mtab: Fix warnings.
* trans/mtab.c (get_credentials): Fix error handling.
(mtab_populate): Fix type.
(trivfs_S_io_seek): Avoid implicit fallthrough warnings.
---
trans/mtab.c | 36 ++++++++++++++++++++----------------
1 file changed, 20 insertions(+), 16 deletions(-)
diff --git a/trans/mtab.c b/trans/mtab.c
index c03749c..a69ede6 100644
--- a/trans/mtab.c
+++ b/trans/mtab.c
@@ -141,31 +141,34 @@ size_t uids_len, gids_len;
error_t
get_credentials (void)
{
+ int len, len_;
/* Fetch uids... */
- uids_len = geteuids (0, 0);
- if (uids_len < 0)
+ len = geteuids (0, NULL);
+ if (len < 0)
return errno;
- uids = malloc (uids_len * sizeof (uid_t));
+ uids = malloc (len * sizeof (uid_t));
if (! uids)
return ENOMEM;
- uids_len = geteuids (uids_len, uids);
- if (uids_len < 0)
+ len_ = geteuids (len, uids);
+ if (len_ != len)
return errno;
+ uids_len = (size_t) len;
/* ... and gids. */
- gids_len = getgroups (0, 0);
- if (gids_len < 0)
+ len = getgroups (0, NULL);
+ if (len < 0)
return errno;
- gids = malloc (gids_len * sizeof (gid_t));
- if (! uids)
+ gids = malloc (len * sizeof (gid_t));
+ if (! gids)
return ENOMEM;
- gids_len = getgroups (gids_len, gids);
- if (gids_len < 0)
+ len_ = getgroups (len, gids);
+ if (len_ != len)
return errno;
+ gids_len = (size_t) len;
return 0;
}
@@ -428,7 +431,7 @@ mtab_populate (struct mtab *mtab, const char *path, int
insecure)
goto errout;
}
- for (int i = 1; i < count - 1; i++)
+ for (size_t i = 1; i < count - 1; i++)
{
char *v = argv[i];
@@ -775,13 +778,14 @@ trivfs_S_io_seek (struct trivfs_protid *cred,
goto check;
case SEEK_END:
offs += op->contents_len;
+ goto check;
case SEEK_SET:
check:
if (offs >= 0)
- {
- *new_offs = op->offs = offs;
- break;
- }
+ *new_offs = op->offs = offs;
+ else
+ err = EINVAL;
+ break;
default:
err = EINVAL;
}
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 09/43: libshouldbeinlibc: Add missing include., (continued)
- [hurd] 09/43: libshouldbeinlibc: Add missing include., Samuel Thibault, 2017/09/11
- [hurd] 05/43: ext2fs: Reduce verbosity of missing xattr support on the FS, Samuel Thibault, 2017/09/11
- [hurd] 11/43: build: Drop unused/unsubstituted config variables, Samuel Thibault, 2017/09/11
- [hurd] 10/43: Revert "Fix taking into account prefix for xkb-data installation", Samuel Thibault, 2017/09/11
- [hurd] 19/43: libdiskfs: Make mapping the time device more robust., Samuel Thibault, 2017/09/11
- [hurd] 01/43: procfs: Remove superfluous calls., Samuel Thibault, 2017/09/11
- [hurd] 13/43: Fix harmless indentation errors tripping [-Wmisleading-indentation]., Samuel Thibault, 2017/09/11
- [hurd] 22/43: libshouldbeinlibc: Fix wiring code., Samuel Thibault, 2017/09/11
- [hurd] 27/43: eth-multiplexer: Generalize function and improve error handling., Samuel Thibault, 2017/09/11
- [hurd] 32/43: eth-multiplexer: Fix type check., Samuel Thibault, 2017/09/11
- [hurd] 38/43: trans/mtab: Fix warnings.,
Samuel Thibault <=
- [hurd] 41/43: exec: Avoid calling mmap with zero size, Samuel Thibault, 2017/09/11
- [hurd] 24/43: eth-multiplexer: Fix error handling., Samuel Thibault, 2017/09/11
- [hurd] 12/43: Fix typo., Samuel Thibault, 2017/09/11
- [hurd] 21/43: startup: Fix retrieving the privileged ports., Samuel Thibault, 2017/09/11
- [hurd] 25/43: eth-multiplexer: Implement getting the devices flags., Samuel Thibault, 2017/09/11
- [hurd] 20/43: ext2fs: Fix warning., Samuel Thibault, 2017/09/11
- [hurd] 18/43: Make build system more robust., Samuel Thibault, 2017/09/11
- [hurd] 14/43: procfs: Provide 'hostinfo'., Samuel Thibault, 2017/09/11
- [hurd] 23/43: startup: Improve error handling., Samuel Thibault, 2017/09/11
- [hurd] 28/43: eth-multiplexer: Allow setting of flags., Samuel Thibault, 2017/09/11