| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: rump_sunos_compat.c,v 1.1 2013/04/09 13:08:33 pooka Exp $ */ | | 1 | /* $NetBSD: rump_sunos_compat.c,v 1.1.26.1 2017/08/12 04:17:37 snj Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2013 Antti Kantee. All Rights Reserved. | | 4 | * Copyright (c) 2013 Antti Kantee. All Rights Reserved. |
5 | * | | 5 | * |
6 | * Redistribution and use in source and binary forms, with or without | | 6 | * Redistribution and use in source and binary forms, with or without |
7 | * modification, are permitted provided that the following conditions | | 7 | * modification, are permitted provided that the following conditions |
8 | * are met: | | 8 | * are met: |
9 | * 1. Redistributions of source code must retain the above copyright | | 9 | * 1. Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | | 10 | * notice, this list of conditions and the following disclaimer. |
11 | * 2. Redistributions in binary form must reproduce the above copyright | | 11 | * 2. Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the | | 12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. | | 13 | * documentation and/or other materials provided with the distribution. |
14 | * | | 14 | * |
| @@ -303,28 +303,30 @@ again: | | | @@ -303,28 +303,30 @@ again: |
303 | &ncookies); | | 303 | &ncookies); |
304 | if (error) | | 304 | if (error) |
305 | goto out; | | 305 | goto out; |
306 | | | 306 | |
307 | inp = buf; | | 307 | inp = buf; |
308 | outp = SCARG(uap, buf); | | 308 | outp = SCARG(uap, buf); |
309 | resid = SCARG(uap, nbytes); | | 309 | resid = SCARG(uap, nbytes); |
310 | if ((len = buflen - auio.uio_resid) == 0) | | 310 | if ((len = buflen - auio.uio_resid) == 0) |
311 | goto eof; | | 311 | goto eof; |
312 | | | 312 | |
313 | for (cookie = cookiebuf; len > 0; len -= reclen) { | | 313 | for (cookie = cookiebuf; len > 0; len -= reclen) { |
314 | bdp = (struct dirent *)inp; | | 314 | bdp = (struct dirent *)inp; |
315 | reclen = bdp->d_reclen; | | 315 | reclen = bdp->d_reclen; |
316 | if (reclen & 3) | | 316 | if (reclen & 3) { |
317 | panic("sunos_getdents"); | | 317 | error = EIO; |
| | | 318 | goto out; |
| | | 319 | } |
318 | if ((*cookie >> 32) != 0) { | | 320 | if ((*cookie >> 32) != 0) { |
319 | printf("rump_sunos_sys_getdents: offset too large\n"); | | 321 | printf("rump_sunos_sys_getdents: offset too large\n"); |
320 | error = EINVAL; | | 322 | error = EINVAL; |
321 | goto out; | | 323 | goto out; |
322 | } | | 324 | } |
323 | if (bdp->d_fileno == 0) { | | 325 | if (bdp->d_fileno == 0) { |
324 | inp += reclen; /* it is a hole; squish it out */ | | 326 | inp += reclen; /* it is a hole; squish it out */ |
325 | if (cookie) | | 327 | if (cookie) |
326 | off = *cookie++; | | 328 | off = *cookie++; |
327 | else | | 329 | else |
328 | off += reclen; | | 330 | off += reclen; |
329 | continue; | | 331 | continue; |
330 | } | | 332 | } |