chiark / gitweb /
rules: fix wrong wildcard match, we always need a ':*' at the end
[elogind.git] / extras / scsi_id / scsi_id.c
index 5c406585561a32fdce20b5684898d2bb72265014..c14d411841ab6d85e3431721565817fb078aaa8c 100644 (file)
@@ -1,18 +1,19 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * scsi_id.c
- *
- * Main section of the scsi_id program
- *
+/*
  * Copyright (C) IBM Corp. 2003
  * Copyright (C) SUSE Linux Products GmbH, 2006
  *
- * Author:
- *     Patrick Mansfield<patmans@us.ibm.com>
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
  *
- *     This program is free software; you can redistribute it and/or modify it
- *     under the terms of the GNU General Public License as published by the
- *     Free Software Foundation version 2 of the License.
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <stdio.h>
@@ -198,6 +199,7 @@ static int get_file_options(struct udev *udev,
         */
        buffer = malloc(MAX_BUFFER_LEN);
        if (!buffer) {
+               fclose(fd);
                err(udev, "can't allocate memory\n");
                return -1;
        }
@@ -574,6 +576,9 @@ static int scsi_id(struct udev *udev, char *maj_min_dev)
                                printf("ID_WWN_WITH_EXTENSION=0x%s\n", dev_scsi.wwn);
                        }
                }
+               if (dev_scsi.tgpt_group[0] != '\0') {
+                       printf("ID_TARGET_PORT=%s\n", dev_scsi.tgpt_group);
+               }
                if (dev_scsi.unit_serial_number[0] != '\0') {
                        printf("ID_SCSI_SERIAL=%s\n", dev_scsi.unit_serial_number);
                }