~ilya-yanok/ubuntu/precise/grub2/fix-for-948716

« back to all changes in this revision

Viewing changes to commands/search.c

  • Committer: Bazaar Package Importer
  • Author(s): Robert Millan
  • Date: 2009-07-25 19:00:53 UTC
  • mfrom: (1.6.3 upstream)
  • mto: (17.4.13 sid)
  • mto: This revision was merged to the branch mainline in revision 53.
  • Revision ID: james.westby@ubuntu.com-20090725190053-uv3lm6ya3zxs77ep
ImportĀ upstreamĀ versionĀ 1.96+20090725

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
static const struct grub_arg_option options[] =
31
31
  {
32
 
    {"file",            'f', 0, "search devices by a file", 0, 0},
 
32
    {"file",            'f', 0, "search devices by a file (default)", 0, 0},
33
33
    {"label",           'l', 0, "search devices by a filesystem label", 0, 0},
34
34
    {"fs-uuid",         'u', 0, "search devices by a filesystem UUID", 0, 0},
35
35
    {"set",             's', GRUB_ARG_OPTION_OPTIONAL, "set a variable to the first device found", "VAR", ARG_TYPE_STRING},
51
51
{
52
52
  int count = 0;
53
53
  char *buf = NULL;
54
 
  grub_fs_autoload_hook_t saved_autoload;
55
54
 
56
55
  auto int iterate_device (const char *name);
57
56
  int iterate_device (const char *name)
132
131
    return (found && var);
133
132
  }
134
133
 
135
 
  /* First try without autoloading if we're setting variable. */
136
 
  if (var)
137
 
    {
138
 
      saved_autoload = grub_fs_autoload_hook;
139
 
      grub_fs_autoload_hook = 0;
140
 
      grub_device_iterate (iterate_device);
141
 
 
142
 
      /* Restore autoload hook.  */
143
 
      grub_fs_autoload_hook = saved_autoload;
144
 
 
145
 
      /* Retry with autoload if nothing found.  */
146
 
      if (grub_errno == GRUB_ERR_NONE && count == 0)
147
 
        grub_device_iterate (iterate_device);
148
 
    }
149
 
  else
150
 
    grub_device_iterate (iterate_device);
 
134
  grub_device_iterate (iterate_device);
151
135
 
152
136
  grub_free (buf);
153
137