| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: disks.c,v 1.106 2009/08/23 18:43:33 jmcneill Exp $ */ | | 1 | /* $NetBSD: disks.c,v 1.107 2009/10/01 10:41:03 jmcneill Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright 1997 Piermont Information Systems Inc. | | 4 | * Copyright 1997 Piermont Information Systems Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Written by Philip A. Nelson for Piermont Information Systems Inc. | | 7 | * Written by Philip A. Nelson for Piermont Information Systems Inc. |
8 | * | | 8 | * |
9 | * Redistribution and use in source and binary forms, with or without | | 9 | * Redistribution and use in source and binary forms, with or without |
10 | * modification, are permitted provided that the following conditions | | 10 | * modification, are permitted provided that the following conditions |
11 | * are met: | | 11 | * are met: |
12 | * 1. Redistributions of source code must retain the above copyright | | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * 2. Redistributions in binary form must reproduce the above copyright | | 14 | * 2. Redistributions in binary form must reproduce the above copyright |
| @@ -278,26 +278,28 @@ get_descr_ata(struct disk_desc *dd, int | | | @@ -278,26 +278,28 @@ get_descr_ata(struct disk_desc *dd, int |
278 | return 1; | | 278 | return 1; |
279 | } | | 279 | } |
280 | | | 280 | |
281 | static void | | 281 | static void |
282 | get_descr(struct disk_desc *dd) | | 282 | get_descr(struct disk_desc *dd) |
283 | { | | 283 | { |
284 | char diskpath[MAXPATHLEN]; | | 284 | char diskpath[MAXPATHLEN]; |
285 | int fd = -1; | | 285 | int fd = -1; |
286 | | | 286 | |
287 | fd = opendisk(dd->dd_name, O_RDONLY, diskpath, sizeof(diskpath), 0); | | 287 | fd = opendisk(dd->dd_name, O_RDONLY, diskpath, sizeof(diskpath), 0); |
288 | if (fd < 0) | | 288 | if (fd < 0) |
289 | goto done; | | 289 | goto done; |
290 | | | 290 | |
| | | 291 | dd->dd_descr[0] = '\0'; |
| | | 292 | |
291 | /* try ATA */ | | 293 | /* try ATA */ |
292 | if (get_descr_ata(dd, fd)) | | 294 | if (get_descr_ata(dd, fd)) |
293 | goto done; | | 295 | goto done; |
294 | /* try SCSI */ | | 296 | /* try SCSI */ |
295 | if (get_descr_scsi(dd, fd)) | | 297 | if (get_descr_scsi(dd, fd)) |
296 | goto done; | | 298 | goto done; |
297 | | | 299 | |
298 | done: | | 300 | done: |
299 | if (fd >= 0) | | 301 | if (fd >= 0) |
300 | close(fd); | | 302 | close(fd); |
301 | if (strlen(dd->dd_descr) == 0) | | 303 | if (strlen(dd->dd_descr) == 0) |
302 | strcpy(dd->dd_descr, dd->dd_name); | | 304 | strcpy(dd->dd_descr, dd->dd_name); |
303 | } | | 305 | } |