Minor improvement of get_prog_name().
This commit is contained in:
parent
2b904ccef4
commit
24885b3810
@ -979,19 +979,19 @@ static Fl_Window *calc_transient_parent(int ¢er_x, int ¢er_y) {
|
||||
}
|
||||
|
||||
|
||||
static char *get_prog_name() {
|
||||
static const char *get_prog_name() {
|
||||
pid_t pid = getpid();
|
||||
char fname[100];
|
||||
sprintf(fname, "/proc/%u/cmdline", pid);
|
||||
FILE *in = fopen(fname, "r");
|
||||
if (in) {
|
||||
static char line[200];
|
||||
char *p = fgets(line, sizeof(line), in);
|
||||
const char *p = fgets(line, sizeof(line), in);
|
||||
fclose(in);
|
||||
p = strrchr(line, '/'); if (!p) p = line; else p++;
|
||||
return p;
|
||||
}
|
||||
return NULL;
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user